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

Platform specific XAML in Content Page

$
0
0

I am working on a toolbar for my app and hoping to use it in a cross platform manner. To do this I would like to be able to use a platform specific tag inside of my page content for that platform. To do this I would like to use a nice tag from the UWP, FontIcon, to set the icon for an item when using a uwp platform. I know this XAML doesn't work, but in essence what I want to do is the following "In Concept" to set the icon of a menu item command to be a glyph font icon on UWP and just use a file image source on the other platforms for now. How would I go about doing this in reality? I am not sure what the first step is.

<ContentPage.ToolbarItems>
        <ToolbarItem Name="MenuItem2" Order="Primary" Text="Add" Priority="0" Command="{Binding AddItemCommand}" >
            <ToolbarItem.Icon>
                    <On Platform="UWP">
                <FontIcon Glyph="&#xEB52;" FontFamily="Segoe MDL2 Assets" />
                </On>
                   <OnPlatform x:TypeArguments="FileImageSource" iOS="plus.png">
            </ToolbarItem.Icon>
        </ToolbarItem>
    </ContentPage.ToolbarItems>

Viewing all articles
Browse latest Browse all 77050

Trending Articles