WPF 原生不支持系统托盘图标,需要依靠其它方式处理。
1 使用 WinForm 的支持
2 使用 wpf-notifyicon 库
hardcodet/wpf-notifyicon: NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform
里面的 Windowless Sample 项目,提供了最简示例。
2 .net core WPF 的支持
对于 .net core WPF ,需要对 wpf-notifyicon 项目做一些改动才能使用。参见:
System Tray Icons with WPF in the .NET Core 3.0 Preview - Forty Years of Code
MV10/WPF.NotifyIcon.NetCore3: WPF-NotifyIcon library ported to .NET Core 3.0 Preview 1
里面的 Windowless Sample 项目,提供了最简示例。
原文地址:
https://www.cnblogs.com/jasongrass/p/11778108.html
END