Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Using OnPlatform to have platform specific sections

$
0
0

I've used OnPlatform in my XAML to set different values for properties such as borders, but there is one place that I want to show something completely different.

Is it possible to use the OnPlatform element as a conditional control to use different UI for different platforms?

Like this:

<Grid>
    <OnPlatform>
        <OnPlatform.iOS>
            <iOSUiElements />
        </OnPlatform.iOS>
        <OnPlatform.WinPhone>
            <WinPhoneStuff />
        </OnPlatform.WinPhone>
    </OnPlatform>
</Grid>

I know that the point of Xamarin Forms is to use the same layout across everything, but in this one case I need to do something pretty different. Can I use OnPlatform for this, or is there another way?


Viewing all articles
Browse latest Browse all 58056

Trending Articles