Beispiel #1
0
        public ValidationPageViewModel()
        {
            UserName = new ValidatableObject <string>();
            UserName.AddRule(new StringNotEmptyRule("A username is required."));
            UserName.AddRule(new StringLengthRule(3, 10, "Username must be 3-10 characters."));

            Email = new ValidatableObject <string>();
            Email.AddRule(new StringNotEmptyRule("Email is required."));
            Email.AddRule(new EmailRule("Invalid Email."));

            TermsAndCondition = new ValidatableObject <bool>();
            TermsAndCondition.AddRule(new IsValueTrueRule("Please accept terms and condition"));

            _validationGroup = new ValidatableGroup(UserName, Email, TermsAndCondition);

            CheckNameCommand = new RelayCommand(CheckName);
            SubmitCommand    = new AsyncCommand(SubmitAsync);
        }