How to get the minimize box click event of a WPF window?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Sorry this is not about WPF as I have not worked much with WPF. But one more thing you can do is check for Windowstate property during Resized event of Form. And if it is equal to FormWindowState.Minimized then minimize button is clicked (?) ;-)
There's an event called
StateChanged
which (from the help) looks like it might do what you want.The help says it's only supported in .NET 3.0 and 3.5 under Vista, but I've just tried it on XP and it fires when the window is minimized, maximized and restored. However, from my testing, it fires after the state has changed, so if you want to do something before the window minimized this might not be the approach you need.
You'll have to check the actual state to make sure it's correct.
Obviously if I was just printing out the state I'd use
this.WindowState.ToString()
;)The following should get added to the XAML defintion of your window by Visual Studio:
In addition to Shoban's answer...
You can make use of Window's Deactivated event, you can even use StateChange Event as below
it would help....