XAML C# not WEB page is a Window
At the click of a button I:
OnFocus
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With