XAML C# not WEB page is a Window
At the click of a button I:
- Need to trap the name of the last control
OnFocus
- Force the
LostFocus
event of the control.
// PROBLEM: clicking on btns does not force lostfocus event on the last entered element control (last entry control could be text,checkbox or others) added save button, where calling such method it moves focus to parent forcing lostfocus on last element.
private void btnSave_Click(object sender, RoutedEventArgs e)
{
AcceptLastFocusedElement(sender, e);
}
private void AcceptLastFocusedElement(object sender, RoutedEventArgs e)
{
FocusManager.SetFocusedElement(this, (Button)sender);
}
NOTE: no need for task number 1 (getting the name of the element).