Untitled
using System.Windows; using System.Windows.Controls; using Airline_Reservation_System.ViewModels; namespace Airline_Reservation_System.Views { public partial class RegistrationWindow : Window { private readonly RegistrationViewModel _viewModel; public RegistrationWindow() { InitializeComponent(); _viewModel = new RegistrationViewModel(); DataContext = _viewModel; } private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) { if (_viewModel != null) { _viewModel.Password = PasswordBox.Password; ValidatePasswords(); } } private void ConfirmPasswordBox_PasswordChanged(object sender, RoutedEventArgs e) { ValidatePasswords(); } private void ValidatePasswords() { if (PasswordBox.Password != ConfirmPasswordBox.Password) { _viewModel.ErrorMessage = "Passwords do not match."; } else { _viewModel.ErrorMessage = string.Empty; } } } }
Leave a Comment