private void UsernameTextBox_GotFocus(object sender, RoutedEventArgs e) { UsernameTextBox.SelectAll(); ErrorUsernameTextBlock.Visibility = Visibility.Collapsed; ErrorProviderTextBlock.Visibility = Visibility.Collapsed; //SetTextBlockVisibilityCollapsed(); }
private void OnLoaded(object sender, RoutedEventArgs e) { this.viewModel = (MainViewModel)this.DataContext; UsernameTextBox.Text = "Wizard " + new Random().Next(0, 100); UsernameTextBox.Focus(); UsernameTextBox.SelectAll(); }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { UsernameTextBox.Focus(); UsernameTextBox.SelectAll(); IRequestFocus focus = (IRequestFocus)DataContext; focus.FocusRequested += OnFocusRequested; }
public UserCreationView() { InitializeComponent(); Loaded += OnLoaded; UsernameTextBox.GotFocus += (_, __) => UsernameTextBox.SelectAll(); PasswordBox1.GotFocus += (_, __) => PasswordBox1.SelectAll(); PasswordBox2.GotFocus += (_, __) => PasswordBox2.SelectAll(); }
private void OnLoaded(object sender, RoutedEventArgs e) { Loaded -= OnLoaded; // Immediately focus the username textbox // when the settings window is opened. UsernameTextBox?.Focus(); UsernameTextBox?.SelectAll(); // Subscribe to the ICloseable.RequestedClose event // to close this view when requested to by the ViewModel. this.MakeCloseable(); }
private void UsernameTextBox_GotFocus(object sender, Windows.UI.Xaml.RoutedEventArgs e) { UsernameTextBox.SelectAll(); UsernamePath.Fill = new SolidColorBrush(Colors.Teal); ErrorProviderTextBlock.Visibility = Visibility.Collapsed; }