M
moondaddy
I have a c# 3.5 wpf app which uses user controls for data entry screens.
These data entry screens can be nested inside of each. We can also have
several ones open side by side at the same time. All are in a single
window. My challenge is to know when a data entry screen (UC) becomes the
active control, and when the active user control looses focus and when the
next one gets the focus, and so on. When a user control gets or looses
focus, I want to configure buttons in the window's toolbar according to the
user control that currently has the focus and its current state. In the
winforms days, I could use the user control's Enter and Leave events which
worked very well. In this case I tried to use the user control's GotFocus
and LostFocus events which doesn't work very well at all
this.Focusable = true;
this.GotFocus += new RoutedEventHandler(ucRole_LUProps_GotFocus);
this.LostFocus += new RoutedEventHandler(ucRole_LUProps_LostFocus);
The GotFocus event only fires when I click in a control such as a textbox or
combobox in the user control. It doesn't fire when I mouse click on the
user control it's self or when I tab into it. Furthermore, The Lostfocus
event never fires.
Can anyone recommend a good solution to the problem?
Thanks.
These data entry screens can be nested inside of each. We can also have
several ones open side by side at the same time. All are in a single
window. My challenge is to know when a data entry screen (UC) becomes the
active control, and when the active user control looses focus and when the
next one gets the focus, and so on. When a user control gets or looses
focus, I want to configure buttons in the window's toolbar according to the
user control that currently has the focus and its current state. In the
winforms days, I could use the user control's Enter and Leave events which
worked very well. In this case I tried to use the user control's GotFocus
and LostFocus events which doesn't work very well at all
this.Focusable = true;
this.GotFocus += new RoutedEventHandler(ucRole_LUProps_GotFocus);
this.LostFocus += new RoutedEventHandler(ucRole_LUProps_LostFocus);
The GotFocus event only fires when I click in a control such as a textbox or
combobox in the user control. It doesn't fire when I mouse click on the
user control it's self or when I tab into it. Furthermore, The Lostfocus
event never fires.
Can anyone recommend a good solution to the problem?
Thanks.