# XAML Markup Extensions ## OnIdiom [OnIdiom Documentation](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/markup-extensions/consuming#onidiom-markup-extension) Example: ``` xml <BoxView Color="{OnIdiom Yellow, Phone=Red, Tablet=Green, Desktop=Blue}" WidthRequest="{OnIdiom 100, Phone=200, Tablet=300, Desktop=400}" HeightRequest="{OnIdiom 100, Phone=200, Tablet=300, Desktop=400}" HorizontalOptions="Center" /> ``` Another way to use it, with type arguments: [List of primitive type arguments](https://docs.microsoft.com/en-us/dotnet/desktop/xaml-services/types-for-primitives#xaml-2009-language-primitives) ``` xml <StackLayout Grid.Column="0" VerticalOptions="CenterAndExpand" HorizontalOptions="Center"> <StackLayout.IsVisible> <OnIdiom x:TypeArguments="x:Boolean"> <OnIdiom.Phone>true</OnIdiom.Phone> <OnIdiom.Tablet>false</OnIdiom.Tablet> <OnIdiom.Desktop>false</OnIdiom.Desktop> </OnIdiom> </StackLayout.IsVisible> </StackLayout> ``` ## OnPlatform [OnPlatform Documentation](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/markup-extensions/consuming#onplatform-markup-extension) Example: ``` xml <BoxView Color="{OnPlatform Yellow, iOS=Red, Android=Green, UWP=Blue}" WidthRequest="{OnPlatform 250, iOS=200, Android=300, UWP=400}" HeightRequest="{OnPlatform 250, iOS=200, Android=300, UWP=400}" HorizontalOptions="Center" /> ```