繁体   English   中英

当用户在其外部单击时,关闭WPF对话框窗口

[英]close a WPF Dialog Window when the user clicks outside it

早安,在这里我想最小化WPF窗口,而用户在窗口外部单击。

我可以通过此代码轻松地最小化窗口

mywindow.WindowState= WindowState.Minimized;

但是我想在单击窗口外部时最小化窗口。

我搜索了。 但是我只能得到像这样的FocusEvent,MouseMove,MouseDown等各种事件的输出。 那些不能解决我的问题

您可以使用Deactivated事件。 请查看MSDN以获取更多信息。

在以下情况下,窗口被停用(成为背景窗口):

 A user switches to another window in the current application. A user switches to the window in another application by using ALT+TAB or by using Task Manager. A user clicks the taskbar button for a window in another application. 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM