在Xaml中设置最小或最大网格行高度(Xamarin.Forms) [英] Set minimum or maximum Height of Row of Grid in Xaml (Xamarin.Forms)
本文介绍了在Xaml中设置最小或最大网格行高度(Xamarin.Forms)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用Xaml或后面的代码在Xamarin.Forms中设置Grid
的RowDefinition
的最小高度.我没有找到任何类似MinHeight或MaxHeight的属性. RowDefinition
只有高度属性.
I need to set minimum height of a RowDefinition
of Grid
in 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>
推荐答案
您可以执行以下操作来设置您的MinimumHeight
:
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>
注意:MinimumHeightRequest
将在要求的高度和要求的最小高度之间选择最小值. 来源
Note: The MinimumHeightRequest
will chose the minimum between your requested height and your requested minimum height. Source
这篇关于在Xaml中设置最小或最大网格行高度(Xamarin.Forms)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文