I use Template Studio WPF to autogenerate the template of my UI. In the "ShellViewModel" I set up the HamburgerMenuItem container
public ObservableCollection<HamburgerMenuItem> MenuItems { get; } = new ObservableCollection<HamburgerMenuItem>()
{
new HamburgerMenuGlyphItem() { Label = Resources.ShellMainPage, Glyph = "\uE8A5", TargetPageType = typeof(MainViewModel) },
new HamburgerMenuGlyphItem() { Label = Resources.ShellListDetailsPage, Glyph = "\uE8A5", TargetPageType = typeof(ListDetailsViewModel) },
};
Now I want to replace HamburgerMenuGlyphItem
with HamburgerMenuIconItem
or HamburgerMenuImageItem
.
new HamburgerMenuIconItem() { Label = Resources.ShellListDetailsPage, Icon = Resources.ExcelParserIcoNeu, TargetPageType = typeof(ListDetailsViewModel) },
With Resources.ExcelParserIcoNeu
I get an Object of Type System.Drawing.Icon
defined in my Resources.
Here is the output of my HamburgerMenuIconItem
As you can see, it does not render the Icon correctly.
Then I tried to use HamburgerMenuImageItem
to do the job.
new HamburgerMenuImageItem(){ Label = Resources.ShellExcelParserPage, Thumbnail= new BitmapImage(new Uri(ExcelJpg)), TargetPageType = typeof(ExcelParserViewModel) }
with
static string ExcelJpg = "pack://application:,,,/Images/excelparsericoneu.jpg";
there I get the error message at runtime that path of the image can not be resolved. The Folder "Images" is part of my Project and contains the file as you can see in the following picture.
If I pass the absolute path it works correctly.
I googled a lot regarding this topic but wars not able to find a solution.
Can you please help me with my issues or point me in the right direction?
thanks, alot.