Xamarin 表格:RowDefinition 高度 OnIdiom 属性 的正确格式是什么?
Xamarin forms: What is the correct format of RowDefinition height OnIdiom property?
我在一个网格中有 2 行,因为第一行的大小是固定的。我正在尝试在此处应用 OnIdiom
功能。尝试如下:
<Grid.RowDefinitions>
<RowDefinition>
<RowDefinition.Height>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>30</OnIdiom.Phone>
<OnIdiom.Tablet>60</OnIdiom.Tablet>
</OnIdiom>
</RowDefinition.Height>
</RowDefinition>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
但在错误列表中出现以下错误:
No property, bindable property, or event found for 'Height', or mismatching type between value and property.
RowDefinition height OnIdiom 的正确格式是什么属性?
您可以使用 OnIdiom
标记扩展:
<RowDefinition Height="{OnIdiom Phone=30, Tablet=60}"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{OnIdiom Phone=30, Tablet=60}" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
BackgroundColor="Blue"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
</Grid>
我在一个网格中有 2 行,因为第一行的大小是固定的。我正在尝试在此处应用 OnIdiom
功能。尝试如下:
<Grid.RowDefinitions>
<RowDefinition>
<RowDefinition.Height>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>30</OnIdiom.Phone>
<OnIdiom.Tablet>60</OnIdiom.Tablet>
</OnIdiom>
</RowDefinition.Height>
</RowDefinition>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
但在错误列表中出现以下错误:
No property, bindable property, or event found for 'Height', or mismatching type between value and property.
RowDefinition height OnIdiom 的正确格式是什么属性?
您可以使用 OnIdiom
标记扩展:
<RowDefinition Height="{OnIdiom Phone=30, Tablet=60}"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{OnIdiom Phone=30, Tablet=60}" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
BackgroundColor="Blue"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
</Grid>