For Views, I found a good XAML workaround to conditional display per platform, by setting View.IsVisible using OnPlatform, like so:
<Button Text="Whatever">
<Button.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean">
<OnPlatform.iOS>True</OnPlatform.iOS>
<OnPlatform.Android>False</OnPlatform.Android>
<OnPlatform.WinPhone>False</OnPlatform.WinPhone>
</OnPlatform>
</Button.IsVisible>
</Button>
But for a ToolbarItem, which isn't a View and doesn't have IsVisible, I can't use that approach. I'm trying to use OnPlatform in the only way I can think to do it (below), but this gives me a System.Reflection.TargetInvocationException.
<ContentPage.ToolbarItems>
<OnPlatform x:TypeArguments="ToolbarItem">
<OnPlatform.iOS>
<ToolbarItem Name="Whatever" />
</OnPlatform.iOS>
</OnPlatform>
</ContentPage.ToolbarItems>
Is what I want to do possible? And to make clear up front, I know this can be done in the codebehind, but I want to know if there's a XAML solution. If so, could someone please point me in the right direction? Thanks!