Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ContextAction MenuItem Icon not showing in iOS platform in Xamarin.Forms PCL based solution

Hi i'm developing app using Xamarin.Forms PCL based solution.For my app i need Listview ViewCell Contextaction. I referred this document to add the contextActions.When i ran it in android the icon is displaying.but in iOS it is not working.

Xaml code

 <ViewCell.ContextActions>
    <MenuItem Text="Edit" x:Name="MenuEdit" />
    <MenuItem Clicked="OnDeleteMenu" Icon="dustbin.png" Text="Delete" IsDestructive="true" 
        CommandParameter="{Binding .}" />
  </ViewCell.ContextActions> 

Please anyone give the solution or related sources.

like image 595
mahbaleshwar hegde Avatar asked Apr 22 '15 07:04

mahbaleshwar hegde


2 Answers

I asked Xamarin support the same question few weeks ago.

Below is the answer I got:


iOS does not support icons in the context menus like Android. You can use something like this to support both platforms:

<MenuItem Icon="dustbin.png" Clicked="OnDeleteMenu" Text="Delete"/>

This will show the text on iOS and the Icon on Android.

If you would like to see this feature added to Xamarin.Forms, please add a new post to https://xamarin.uservoice.com/forums/258559-xamarin-forms-suggestions.

like image 66
Grisha Avatar answered Oct 30 '22 02:10

Grisha


:D I found the solution for icon on iOS by using font. ex: Text="❤ Favorite"

like image 1
mrfour.it Avatar answered Oct 30 '22 02:10

mrfour.it