tags:

views:

9

answers:

1

XAML C# not WEB page is a Window

at the click of a button I :

1) need to trap the name of the last control onfocus 2) would like to Force the lost focus event of the control.

TIA

A: 

// 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).

ramnz