WPF应用程序只有一个托盘图标(WPF Application that only has a tray icon)

编程入门 行业动态 更新时间:2024-10-25 00:28:10
WPF应用程序只有一个托盘图标(WPF Application that only has a tray icon)

我是一个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/

更多推荐

本文发布于:2023-08-04 15:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417713.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:只有一个   托盘   应用程序   图标   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!