private bool IsValid() { TbUsername.GetBindingExpression(TextBox.TextProperty).UpdateSource(); PbPassword.GetBindingExpression(PasswordHelper.PasswordProperty).UpdateSource(); return(!Validation.GetHasError(TbUsername) && !Validation.GetHasError(PbPassword)); }
private bool IsValid(bool isEdit) { if (!isEdit) { TbUsername.GetBindingExpression(TextBox.TextProperty).UpdateSource(); PbPassword.GetBindingExpression(PasswordHelper.PasswordProperty).UpdateSource(); } CbGender.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource(); DpBirthDate.GetBindingExpression(DatePicker.SelectedDateProperty).UpdateSource(); TbName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); TbEmail.GetBindingExpression(TextBox.TextProperty).UpdateSource(); TbPhoneNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); TbAddress.GetBindingExpression(TextBox.TextProperty).UpdateSource(); return(!Validation.GetHasError(CbGender) && !Validation.GetHasError(DpBirthDate) && !Validation.GetHasError(TbName) && !Validation.GetHasError(TbEmail) && !Validation.GetHasError(TbPhoneNumber) && !Validation.GetHasError(TbAddress) && (!isEdit || (!Validation.GetHasError(TbUsername) && !Validation.GetHasError(PbPassword)))); }