This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isValidEmail = User.Email.Validate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Plugin.ValidationRules; | |
| using ValidationRulesTest.Validations; | |
| using ValidationRulesTest.Models; | |
| namespace ValidationRulesTest.ViewModels | |
| { | |
| public class Example2ViewModel | |
| { | |
| public Example2ViewModel() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Plugin.ValidationRules; | |
| namespace ValidationRulesTest.Models | |
| { | |
| public class User | |
| { | |
| public User() | |
| { | |
| LastName = new ValidatableObject<string>(); | |
| Name = new ValidatableObject<string>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Entry Text="{Binding Name.Value, Mode=TwoWay}" /> | |
| <Label Text="{Binding Name.Error}" TextColor="Red" HorizontalTextAlignment="Center" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var errors = Name.Errors; | |
| var error = Name.Error; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _unit1 = new ValidationUnit(Name, LastName, Email); | |
| var isValidUnit = _unit1.Validate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public bool Validate() | |
| { | |
| var isValidName = _name.Validate(); | |
| var isValidLastname = _lastname.Validate(); | |
| var isValidEmail = _email.Validate(); | |
| // Your logic here | |
| return isValidName && isValidLastname && isValidEmail; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Entry Text="{Binding Name.Value, Mode=TwoWay}" > | |
| <Entry.Behaviors> | |
| <behaviors:EventToCommandBehavior EventName="Unfocused" Command="{Binding ValidateUserNameCommand}" /> | |
| </Entry.Behaviors> | |
| </Entry> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isValidEmail = Email.Validate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Email validations | |
| Email.Validations.Add(new IsNotNullOrEmptyRule<string>{ ValidationMessage = "A email is required." }); | |
| Email.Validations.Add(new EmailRule<string> { ValidationMessage = "Email is not valid." }); |