WPF应用程序只能有一个托盘图标托盘、应用程序、图标、有一个

2023-09-02 01:26:55 作者:孟了个野

我是一个总的WPF新手,不知道是否有人可以给我一些指点如何编写启动最小化到系统托盘的应用程序。这个想法是,它会定期抓取RSS源,并创建一个烤面包机,弹出当有新内容。

I am a total WPF newbie and wonder if anyone could give me some pointers how to write an application that starts minimized to tray. The idea is that it periodically fetches an RSS Feed and creates a Toaster-Popup when there are new feeds.

应用程序应该仍然有一个主窗口(实际上就是一个包含所有供稿条目列表),但应该被默认隐藏。

The Application should still have a Main Window (essentially just a list containing all feed entries), but that should be hidden by default.

我已经开始阅读有关XAML和WPF和我知道的StartupUri在App.xaml中有指向我的主窗口,但我不知道正确的方法是做什么的系统托盘图标,隐藏主窗口(这也意味着,当用户最小化窗口,它应尽量减少到托盘,不到任务栏)。

I have started reading about XAML and WPF and I know that the StartupUri in the App.xaml has to point to my main window, but I have no idea what the proper way is to do the SysTray icon and hide the main window (this also means that when the user minimizes the window, it should minimize to tray, not to taskbar).

任何提示?

推荐答案

有没有NotifyIcon的为WPF(还)。

There's no NotifyIcon for WPF (yet).

我的使用这个免费的图书馆,效果良好一位同事:

A colleague of mine used this freely available library to good effect:

HTTP://www.hard$c$ct.net/wpf-notifyicon http://visualstudiogallery.msdn.microsoft.com/aacbc77c-4ef6-456f-80b7-1f157c2909f7/ http://www.hardcodet.net/wpf-notifyicon http://visualstudiogallery.msdn.microsoft.com/aacbc77c-4ef6-456f-80b7-1f157c2909f7/