[英]Detect event when user clicks the program on the taskbar?
I want to know which event is firing in wpf window form if the user click my application on the taskbar to minimize or maximize the application. 如果用户在任务栏上单击我的应用程序以最小化或最大化应用程序,我想知道哪个事件以wpf窗口形式触发。 I just tried Activated and Deactivated events and, it's not working.I mean these events are triggering so many times. 我刚刚尝试过Activated和Deactivated事件,但它没有工作。我的意思是这些事件触发了很多次。 Thanks. 谢谢。
The Window.StateChanged
event is fired after your window is minimized, maximized, or restored. 窗口最小化,最大化或恢复后,将触发Window.StateChanged
事件。
However, if the window is simply obscured by other windows, clicking on the taskbar will bring it to front without changing its size. 但是,如果窗口被其他窗口遮挡,单击任务栏会将其显示在前面而不会改变其大小。 This will trigger the Activated
event, but not StateChanged
. 这将触发Activated
事件,但不会触发StateChanged
。
You can use stateChanged
event of the window. 您可以使用窗口的stateChanged
事件。 It fires when window maximized and minimized i think it solves the problem. 它在窗口最大化和最小化时触发,我认为它解决了问题。
hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.