Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set minimum or maximum Height of Row of Grid in Xaml (Xamarin.Forms)

I need to set minimum height of a RowDefinition of Gridin Xamarin.Forms using Xaml or code behind. I didn't find any property like MinHeight or MaxHeight. There is only Height property for RowDefinition.

<Grid ColumnSpacing="10" Padding="20">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
</Grid>
like image 779
Ashish Kumar Avatar asked Feb 07 '23 19:02

Ashish Kumar


1 Answers

You can do this to set your MinimumHeight:

<Grid ColumnSpacing="10" Padding="20">
    <Grid.RowDefinitions>
        <RowDefinition Height= "Auto"/>
    </Grid.RowDefinitions>
    <ContentView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" MinimumHeightRequest="20">
        ...
    </ContentView>
</Grid>

Note: The MinimumHeightRequest will chose the minimum between your requested height and your requested minimum height. Source

like image 184
Akash Amin Avatar answered Mar 05 '23 16:03

Akash Amin