void LoginControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue == true) { Dispatcher.BeginInvoke( DispatcherPriority.ContextIdle, new Action(() => MyPasswordBox.Focus())); } }
private void MyPasswordBox_GotFocus(object sender, RoutedEventArgs e) { MyPasswordBox.SelectAll(); }