WPF - See Application Icon in Code
I added an icon to my WPF application in the project properties.
How can I refer to this icon to add it to the NotifyIcon I am creating for the system tray.
In the code, which is?
System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
ni.Icon = new System.Drawing.Icon("MyIcon.ico");
Does not work. Malcolm
+1
source to share
2 answers
I think this might be what you are looking for:
How do I use an icon that is a resource in WPF?
You need to insert the icon as a resource and then you can access it from code.
+2
source to share