Detecting a control's focus in Silverlight

后端 未结 2 1161
傲寒
傲寒 2021-02-05 12:05

Is there any way to tell whether a control (specifically a System.Windows.Controls.TextBox) is focused in Silverlight? I\'m looking for something like the following (what you wo

2条回答
  •  萌比男神i
    2021-02-05 12:30

    You have to use FocusManager

    bool b = FocusManager.GetFocusedElement() == textBox;
    

提交回复
热议问题