wpf - How to know if the UserControl is active other than using IsFocused -
i working on wpf project, , trying fire event every time usercontrols active or inactive.
these usercontrols have many other controls inside of them.
i tried achieve using usercontrol events gotfocus
, lostfocus
, these events not working in way need since usercontrol loses focus when work controls inside of it.
so, question is: is there way mantain usercontrol active
while user works controls inside of it, and, when user goes usercontrol first 1 gets inactive
???
thank in advance.
i solve problem thank comments of @lpl , @rachel.
i had use event uielement.iskeyboardfocuswithinchanged
, worked perfectly.
at first had problem callback method being raised infinitely, actual problem was showing messagebox
every time event iskeyboardfocuswithinchanged
raised, so, caused iskeyboardfocuswithin
property changed , created infinite loop. rachel's advice figure out how solve it.
Comments
Post a Comment