我有一个网格,在Windows Univesal中,HeightRequest是160,在Android和iOS上它将是100.如何在XAML中的每个平台识别中执行此操作?
<ListView x:Name="List" IsRefreshing="False" IsPullToRefreshEnabled="True" BackgroundColor="#ffffff">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
//-- if Grid = windows
<Grid Padding="5" HeightRequest="160">
//-- if Grid = ios and android
<Grid Padding="5" HeightRequest="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout HeightRequest="80" WidthRequest="80">
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
答案 0 :(得分:1)
<Grid >
<Grid.HeightRequest>
<OnPlatform x:TypeArguments="x:Double"
iOS="100"
Android="100"
WinPhone="160" />
</Grid.HeightRequest>
</Grid>