I have a WPF app which I'd like to add a badge to its icon under certain conditions - does WPF have a way to do this natively, or should I just replace the icon with a different icon (one to which I've added the badge in an image editor) temporarily when I want the badge to appear?
Asked
Active
Viewed 283 times
-1
-
1I think that you can replace the App icon at runtime. You can also make a NotifyIcon that appears on SysTray https://stackoverflow.com/q/10230579/194717 – Tony Dec 22 '19 at 14:03
-
1Yeah, I already have a tray icon - would like to put a badge over that and over the main app icon. – ekolis Dec 22 '19 at 17:28
1 Answers
1
WPF does not have a built-in method to overlay the icon with a badge, however the method to do it with, SetOverlayIcon()
, is available in Windows API Code Pack; take a look at TaskbarManager.cs. One way to invoke the method in C# would be like:
Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance.SetOverlayIcon(myHandle, myIcon, String.Empty);

mnistic
- 10,866
- 2
- 19
- 33