I have an images folder with a png in it. I would like to set a MenuItem\'s icon to that png. How do I write this in procedural code?
This is how I used it (this way it dont need to be built into the assembly):
MenuItem item = new MenuItem(); string imagePath = "D:\\Images\\Icon.png"); Image icon = new Image(); icon.Source= new BitmapImage(new Uri(imagePath, UriKind.Absolute)); item.Icon = icon;