I have a MainWindow Class (from Window) and there I'm trying to set Overlay icon on my taskbar.
this.TaskbarItemInfo.Overlay = (ImageSource)Resources["WarningImage"];
No matter what I try the Resources are empty (count 0) even though I added an image object in xaml. Is there a reliable way of setting the Overlay icon bypassing resources, loading image from a file? Is there a way to reference resources in ResourceDictionary of an application so that I can set the Overlay using that approach.
// Resources are null no images found
var test = (DrawingImage)this.FindResource("WarningImage");
this.TaskbarItemInfo.Overlay = (ImageSource)Resources["WarningImage"];
Thank you, ~r
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/AppStyles.xaml"/>
<ResourceDictionary>
<DrawingImage x:Key="WarningImage">
<DrawingImage.Drawing>
<ImageDrawing Rect="0,0,16,16" ImageSource="/Images/question.png" />
</DrawingImage.Drawing>
</DrawingImage>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>