如何在 WPF 中检测任务栏上的右键单击
我有一个 C# 中的 WPF 应用程序,它以加载对话框开始。正如预期的那样,该应用程序的按钮会显示在 Windows 任务栏中。
我想检测可能对该按钮进行的右键单击。
最终,我希望禁用右键单击或只是让加载对话框重新获得焦点。我看到有些人使用自定义库和包(例如互操作)来实现某些 Win32 功能,但我个人希望避免这种情况。此外,这些库/包似乎特定于 Windows 窗体;我还没有看到 WPF 的任何内容。 WPF中任务栏右键无法操作吗?
I've got a WPF application in C# that starts off with a loading dialog. As expected, a button for the app shows up in the Windows taskbar.
I would like to detect right-clicks that might be done to that button.
Ultimately, I hope to disable the right-click or simply have the loading dialog regain focus. I've seen that some people use custom libraries and packages (interop, for example) to achieve some Win32 functionality, but I'd personally like to avoid this. Furthermore, these libraries/packages appear to be specific to Windows Forms; I've not seen anything for WPF. Is it impossible to manipulate the taskbar's right-click in WPF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能只在窗口上设置 ShowInTaskbar="False" 吗?
Can you not just set ShowInTaskbar="False" on the window?
您可以在窗口上设置 ShowInTaskbar="False",然后在加载完成后在代码隐藏中将其设置回 true。
You can set ShowInTaskbar="False" on the window, and then once you are done loading set it back to true in code-behind.