Although I can do the following in code, I want to do it in Xaml:
if (Xamarin.Forms.Device.Idiom == TargetIdiom.Phone)
{
MainPage = new NavigationPage(new MyPage());
}
else if(Xamarin.Forms.Device.Idiom == TargetIdiom.Tablet)
{
// etc
}
else if(Xamarin.Forms.Device.Idiom == TargetIdiom.Desktop)
{
// etc
}
else if (Xamarin.Forms.Device.Idiom == TargetIdiom.Unsupported)
{
// etc
}
else
{
// etc
}
Another post suggests the following, however it throws an error "OnIdiom" not found in xmlns: http://xamarin.com/schemas/2014/forms:
<StackLayout>
<StackLayout.Orientation>
<OnIdiom x:TypeArguments="StackOrientation">
<OnIdiom.Phone>Vertical</OnIdiom.Phone>
<OnIdiom.Tablet>Horizontal</OnIdiom.Tablet>
</OnIdiom>
</StackLayout.Orientation>
<Label Text="child0"/>
<Label Text="child1"/>
</StackLayout>
Any ideas as to how to do this in Xaml?