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

How to do a Windows Phone 'OnPlatform' for a ToolBarItem Icon?

$
0
0

This works (the icon is shown) in all platforms including Windows Phone 8.1:

<ToolbarItem Name="{resx:Translate MainPageLogOutLabel}" Command="{Binding LogOutCommand}" Order="Primary" Priority="0" Icon = "LogOut.png" />

However, I only want the icon showing on Windows Phone 8.1. The following Xaml does not work, however:

<ToolbarItem Name="{resx:Translate MainPageLogOutLabel}" Command="{Binding LogOutCommand}" Order="Primary" Priority="0">
   <ToolbarItem.Icon>
     <OnPlatform x:TypeArguments="FileImageSource"
       WinPhone="LogOut.png" />
   </ToolbarItem.Icon>
</ToolbarItem>

And I also tried this syntax, which also does not work:

    <ToolbarItem Name="{resx:Translate MainPageLogOutLabel}" Command="{Binding LogOutCommand}" Order="Primary" Priority="0">
      <ToolbarItem.Icon>
        <OnPlatform x:TypeArguments="FileImageSource">
          <OnPlatform.WinPhone>LogOut.png</OnPlatform.WinPhone>
        </OnPlatform>
      </ToolbarItem.Icon>
    </ToolbarItem>

Any ideas?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>