如何获得通知,当窗口焦点在WPF? [英] How to get notified when a window get focus in WPF?

查看:128
本文介绍了如何获得通知,当窗口焦点在WPF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WPF中单击一个窗口(我使用GotFocus事件)时得到通知,但是只有在窗口中单击组合框时才会触发。我想要的是当窗口或窗口中的任何控件被点击时得到通知。任何想法如何做到这一点? 事件不会被触发,它只能用于控件。 激活事件服务于这个特定的目的。


I want to get notified when I click a window in WPF (I use the GotFocus event), but it only triggers when I click on a Combobox in the window. What I want is to get notified when the the window or any of the controls in the window is clicked. Any ideas of how to do this?

解决方案

The GotFocus event doesn't get fired when the Window gets focus, it's intended to be used with controls only. The Activated event serves this particular purpose.

这篇关于如何获得通知,当窗口焦点在WPF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆