I'm following the example here of binding a MenuItem
to a data object.
<Menu Grid.Row="0" KeyboardNavigation.TabNavigation="Cycle" ItemsSource="{Binding Path=MenuCommands}">
<Menu.ItemContainerStyle>
<Style>
<Setter Property="MenuItem.Header" Value="{Binding Path=DisplayName}"/>
<Setter Property="MenuItem.ItemsSource" Value="{Binding Path=Commands}"/>
<Setter Property="MenuItem.Command" Value="{Binding Path=Command}"/>
<Setter Property="MenuItem.Icon" Value="{Binding Path=Icon}"/>
</Style>
</Menu.ItemContainerStyle>
</Menu>
It all works swimmingly except the MenuItem
's icon shows up as the string (System.Drawing.Bitmap). The bitmap in question is returned by the data object from a compiled resource.
internal static System.Drawing.Bitmap folder_page {
get {
object obj = ResourceManager.GetObject("folder_page", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
What am I doing wrong?