Reputation: 169
I have this grid:
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.07*" />
<ColumnDefinition Width="1.2*" />
<ColumnDefinition Width="0.05*" />
</Grid.ColumnDefinitions>
</Grid>
This Grid is part of titleview in android and ios. I need to center the icon in the middle column but since ios and android handle the title view differently the icon in the middle does sit slightly more left bound on ios while it sits in the center on android. I would need to set different colum widths for each platform.
Is this doable?
Thank you!
Upvotes: 0
Views: 827
Reputation: 9234
You can use following code to achieve for different Colum Definitions for different platforms (android, ios).
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition >
<ColumnDefinition.Width>
<OnPlatform x:TypeArguments="GridLength">
<On Platform="iOS" Value="1.2*"></On>
<On Platform="Android" Value="2.07*"></On>
</OnPlatform>
</ColumnDefinition.Width>
</ColumnDefinition>
<ColumnDefinition Width="1.2*" />
<ColumnDefinition Width="0.05*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Text="By default, a Grid contains one row and one column." />
</Grid>
Upvotes: 1