Hi!
I am trying to add the OnPlatform tag in my XAML ContentPage definition file.
I have a working Android App and now wnat to to make tweaks for the IOS version.
I would like to use the OnPlatform tag to detect whether Android or IOS are being used.
I would also like to detect whether a tablet or phone is in use, but I did not see a tag for this.
1) I tried to add the OnPlatform to my buttons to set the font, but then the text on the buttons just disappeared
OnPlatform version:
<Button> VerticalOptions="CenterAndExpand" Text="{Binding ItsVal}" Clicked="OnAquaDeviceCellClick" <OnPlatform x:TypeArguments="Font" iOS ="15" Android ="13" WinPhone="14" /> </Button>
Generic version that works:
<Button Font="13" VerticalOptions="CenterAndExpand" Text="{Binding ItsVal}" Clicked="OnAquaDeviceCellClick" />
2) I tried to add the OnPlatform in my ListView to set the RowHeight but got a Java exception on Android
OnPlatform version:
<ListView> <OnPlatform x:TypeArguments="RowHeight" iOS ="50" Android ="40" WinPhone="30" /> ItemsSource="{Binding}" ItemTapped="OnGetRidOfSelection" ItemTemplate="{local:DataTemplateSelector Page={x:Reference thePage}" </ListView>
Generic version that works:
<ListView RowHeight="40" ItemsSource="{Binding}" ItemTapped="OnGetRidOfSelection" ItemTemplate="{local:DataTemplateSelector Page={x:Reference thePage}" />
What am I doing wrong?
Do I have to use the code "Device.OS" to do this?
Thanks!