Quantcast
Viewing latest article 6
Browse Latest Browse All 13

Answer by Vladik Y for WPF and initial focus

Had same problem solved it with simple solution:In the main window:

<Window ....        FocusManager.FocusedElement="{Binding ElementName=usercontrolelementname}"         ... />

In the user control:

private void UserControl_GotFocus_1(object sender, RoutedEventArgs e)        {            targetcontrol.Focus();            this.GotFocus -= UserControl_GotFocus_1;  // to set focus only once        }

Viewing latest article 6
Browse Latest Browse All 13

Trending Articles