我是一个WPF新手,想知道有没有人可以给我一些指针如何写一个应用程序,最小化到托盘。 这个想法是,当有新的Feed时,它会定期获取RSS Feed并创建一个Toaster-Popup。
应用程序应该仍然有一个主窗口(基本上只是一个包含所有feed条目的列表),但默认情况下应该隐藏该窗口。
我已经开始阅读有关XAML和WPF的信息,我知道App.xaml中的StartupUri必须指向我的主窗口,但我不知道如何正确的方法来做SysTray图标并隐藏主窗口(这也是意味着当用户最小化窗口时,应尽可能减少托盘,而不是任务栏)。
任何提示?
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.
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).
Any hints?
最满意答案
WPF没有NotifyIcon。
我的一个同事使用这个免费的图书馆效果很好:
http://www.hardcodet.net/wpf-notifyicon (博客文章) https://bitbucket.org/hardcodet/notifyicon-wpf/src (源代码) https://www.nuget.org/packages/Hardcodet.NotifyIcon.Wpf/(NuGet软件包) http://visualstudiogallery.msdn.microsoft.com/aacbc77c-4ef6-456f-80b7-1f157c2909f7/http://www.hardcodet.net/uploads/2009/04/image13.png
There's no NotifyIcon for WPF.
A colleague of mine used this freely available library to good effect:
http://www.hardcodet.net/wpf-notifyicon (blog post) https://bitbucket.org/hardcodet/notifyicon-wpf/src (source code) https://www.nuget.org/packages/Hardcodet.NotifyIcon.Wpf/ (NuGet package) http://visualstudiogallery.msdn.microsoft.com/aacbc77c-4ef6-456f-80b7-1f157c2909f7/更多推荐
发布评论