I'm using Xamarin Studio 6.1, recently upgraded it to work with a Xamarin Forms project. I can't seem to get the OnPlatform tags working. I'm trying something like this
<Grid Padding="12">
<Grid.HeightRequest>
<OnPlatform />
</Grid.HeightRequest>
</Grid>
The previewer immediately breaks and complains Invalid XAML: Type OnPlatform not found in xmlns="http://xamarin.com/schemas/2014/forms"
I've never seen this error before and can't find any help online. Any ideas?
It might because of not specifiying TypeArguments
. Try this:
<Grid.HeightRequest>
<OnPlatform x:TypeArguments="x:Double"
iOS="15" Android="10" WinPhone="10"/>
</Grid.HeightRequest>
Update:
The syntax above is deprecated. The new form is:
<Grid.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="iOS" Value="15"/>
<On Platform="Android" Value="10"/>
<On Platform="WinPhone" Value="10"/>
</OnPlatform>
</Grid.HeightRequest>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With