Author: davidpni | Posted on: 6/20/2008 10:23:37 AM | Views : 425

 I was wondering if anyone had some extra information on what happens when objects get or lose focus.  Here is my situation:
 
I have two objects A and B.  Object B needs to be visible as long as either object A has focus or object B has focus.  Object A is always visible.  If neither object A nor B have focus, then object B is invisible (collapsed).
Now, to try and accomplish this, I am using the GotFocus and LostFocus events as well as the FocusManager object.  Here is an example of the LostFocus function for object B.  My logic is: if object B has lost focus, check to see if object A is the focused element.  If it is, visibility stays the same.  Otherwise, visibility is collapes.  The code:
 void ObjectB_LostFocus(object sender, RoutedEventArgs e)
{
    object objWithFocus = FocusManager.GetFocusedElement();
    if ((FrameworkElement)objWithFocus == Obj ...

Go to the complete details ...