private void Page_Loaded(object sender, RoutedEventArgs e) { if (!TB_UserName.IsEnabled) { PB_Contraseña.Focus(FocusState.Programmatic); } }
private void ConfigureView() { TB_UserName.IsEnabled = this.parameters.User is null; TB_UserName.Text = this.parameters.User?.UserName ?? ""; switch (this.parameters.TipoInicialización) { case TipoInicialización.add: TB_UserName.Visibility = Visibility.Visible; PB_Contraseña.Visibility = Visibility.Visible; TB_NUserName.Visibility = Visibility.Collapsed; PB_NContraseña.Visibility = Visibility.Collapsed; break; case TipoInicialización.changepassword: TB_UserName.Visibility = Visibility.Visible; PB_Contraseña.Visibility = Visibility.Visible; TB_NUserName.Visibility = Visibility.Collapsed; PB_NContraseña.Visibility = Visibility.Visible; break; case TipoInicialización.changeusername: TB_UserName.Visibility = Visibility.Visible; PB_Contraseña.Visibility = Visibility.Visible; TB_NUserName.Visibility = Visibility.Visible; PB_NContraseña.Visibility = Visibility.Collapsed; break; case TipoInicialización.deleteaccount: TB_UserName.Visibility = Visibility.Visible; PB_Contraseña.Visibility = Visibility.Visible; TB_NUserName.Visibility = Visibility.Collapsed; PB_NContraseña.Visibility = Visibility.Collapsed; break; default: TB_UserName.Visibility = Visibility.Collapsed; PB_Contraseña.Visibility = Visibility.Collapsed; TB_NUserName.Visibility = Visibility.Collapsed; PB_NContraseña.Visibility = Visibility.Collapsed; break; } if (!TB_UserName.IsEnabled) { PB_Contraseña.Focus(FocusState.Programmatic); } }