你好,
控件本身是有GotFocus事件的,当控件获得焦点时,该事件是会触发的。
关于判断控件是否有焦点,你可以使用
FocusManager.GetFocusedElement()
例如,判断textbox控件是否有焦点,请参考以下代码:
if (FocusManager.GetFocusedElement() == textBox1)
{
MessageBox.Show("textbox focused");
}
Mark Yu - MSFT
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.