Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

ViewCell.ContextActions MenuItem IconImageSource not working

i want to display Icons in my contextactions. I tried to achive this like so:

        <MenuItem IconImageSource="{Binding BindingContext.AddIcon, Source={x:Reference SMCalendarPage}}"
                           Command="{Binding BindingContext.EditCommand, Source={x:Reference SMCalendarPage}}"
                           CommandParameter="{Binding .}">
      <MenuItem IsDestructive="True"
                         IconImageSource="{Binding BindingContext.DeleteIcon, Source={x:Reference SMCalendarPage}}"
                         Command="{Binding BindingContext.DeleteCommand, Source={x:Reference SMCalendarPage}}"
                         CommandParameter="{Binding .}">

public FontImageSource EditIcon { get; set; }
public FontImageSource DeleteIcon { get; set; }

EditIcon = new FontImageSource
    Glyph = FontAwesome.Edit,
    FontFamily = FontAwesome.GetFontFamily(),
    Size = ((int)NamedSize.Large) * 6

DeleteIcon = new FontImageSource
    Glyph = FontAwesome.TrashAlt,
    FontFamily = FontAwesome.GetFontFamily(),
    Size = ((int)NamedSize.Large) * 6

When setting a breakpoint inside the getters, it breaks as often as i have items inside my listview, so the binding seems to be working. The Icon itself is also correct, as it is also used inside a toolbaritem. However, no icons are rendered inside my contextactions, they are just empty.
What am I doing wrong?


Best Answer


Sign In or Register to comment.