ISFocusManager.GetFocusedElement()

3 replies. Last post: January 2, 2011 10:29 PM by Glenn Layaar
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Bill GowerMember

I am guessing that this method returns the control on the form that has the focus at the time the call is made. Is this true? Why would it ever be null? I have two UXDialogBoxes out of dozens where it returns null. In both forms, I am clicking the Save button at the time and my successful save method calls this method after setting the DialogResult to DialogResult.OK.

Here is the code showing how I am using it.

internal static void CloseCurrentWindow()

{

FrameworkElement element = ISFocusManager.GetFocusedElement() as FrameworkElement; IWindow window = UXWindow.GetWindowHost(element);  In only two dialog boxes element is null if (window != null)

window.Close();

}

}

All times are GMT -5. The time now is 8:26 PM.
Previous Next