Icon ContextAction MenuItem does not display on iOS platform in Xamarin.Forms PCL-based solution

Hi, I am developing an application using the PCL-based Xamarin.Forms solution. For my application, I need a Listview ViewCell Contextaction. I referenced this document to add contextActions. When I launched it in android, the icon is displayed. But on iOS, it does not work.

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 someone give a solution or related sources.

+5
source share
2 answers

I asked Khasarin to support the same question a few weeks ago.

Below is the answer:


iOS does not support icons in context menus such as Android. You can use something similar 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 want this feature to be added to Xamarin.Forms, add a new message at https://xamarin.uservoice.com/forums/258559-xamarin-forms-suggestions .

+8
source

All Articles