ViewCell.ContextActions MenuItem IconImageSource not working

walliwalli Member ✭✭

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

===========View=============
<listview:SxfListView.ItemTemplate>
  <DataTemplate>
    <ViewCell>
      <ViewCell.ContextActions>
        <MenuItem IconImageSource="{Binding BindingContext.AddIcon, Source={x:Reference SMCalendarPage}}"
                           Command="{Binding BindingContext.EditCommand, Source={x:Reference SMCalendarPage}}"
                           CommandParameter="{Binding .}">
      </MenuItem>
      <MenuItem IsDestructive="True"
                         IconImageSource="{Binding BindingContext.DeleteIcon, Source={x:Reference SMCalendarPage}}"
                         Command="{Binding BindingContext.DeleteCommand, Source={x:Reference SMCalendarPage}}"
                         CommandParameter="{Binding .}">
      </MenuItem>
    </ViewCell.ContextActions>

=========ViewModel=================
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?

Regards
Gabriel

Best Answer

Answers

Sign In or Register to comment.