Change capitalisation of ValidationModeBase.AutoValidate

This commit is contained in:
Antony Male 2014-08-02 17:54:15 +01:00
parent d9db561494
commit 9532f3eca1
4 changed files with 14 additions and 10 deletions

View File

@ -67,7 +67,7 @@
<Label Grid.Row="4" Grid.Column="0" Target="{Binding ElementName=PasswordConfirmation}">Password Confirmation:</Label> <Label Grid.Row="4" Grid.Column="0" Target="{Binding ElementName=PasswordConfirmation}">Password Confirmation:</Label>
<PasswordBox Grid.Row="4" Grid.Column="1" x:Name="PasswordConfirmation" xaml:Secure.Password="{Binding PasswordConfirmation}"/> <PasswordBox Grid.Row="4" Grid.Column="1" x:Name="PasswordConfirmation" xaml:Secure.Password="{Binding PasswordConfirmation}"/>
<CheckBox Grid.Row="5" Grid.Column="0" IsChecked="{Binding AutoValidate}">Auto-Validate</CheckBox> <CheckBox Grid.Row="5" Grid.Column="0" IsChecked="{Binding ShouldAutoValidate}">Auto-Validate</CheckBox>
<Button Grid.Row="5" Grid.Column="1" Command="{s:Action Submit}" HorizontalAlignment="Left">Submit</Button> <Button Grid.Row="5" Grid.Column="1" Command="{s:Action Submit}" HorizontalAlignment="Left">Submit</Button>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -17,10 +17,14 @@ namespace Stylet.Samples.ModelValidation.Pages
public string PasswordConfirmation { get; set; } public string PasswordConfirmation { get; set; }
public Stringable<int> Age { get; set; } public Stringable<int> Age { get; set; }
public bool AutoValidate public bool ShouldAutoValidate
{ {
get { return this.autoValidate; } get { return base.AutoValidate; }
set { this.autoValidate = value; this.NotifyOfPropertyChange(); } set
{
base.AutoValidate = value;
this.NotifyOfPropertyChange();
}
} }
public UserViewModel(IWindowManager windowManager, IModelValidator<UserViewModel> validator) : base(validator) public UserViewModel(IWindowManager windowManager, IModelValidator<UserViewModel> validator) : base(validator)
@ -37,7 +41,7 @@ namespace Stylet.Samples.ModelValidation.Pages
public bool CanSubmit public bool CanSubmit
{ {
get { return !this.AutoValidate || !this.HasErrors; } get { return !this.ShouldAutoValidate || !this.HasErrors; }
} }
public void Submit() public void Submit()
{ {

View File

@ -43,14 +43,14 @@ namespace Stylet
/// <summary> /// <summary>
/// Whether to run validation for a property automatically every time that property changes /// Whether to run validation for a property automatically every time that property changes
/// </summary> /// </summary>
protected bool autoValidate { get; set; } protected bool AutoValidate { get; set; }
/// <summary> /// <summary>
/// Instantiate, without using an IValidatorAdapter /// Instantiate, without using an IValidatorAdapter
/// </summary> /// </summary>
public ValidatingModelBase() public ValidatingModelBase()
{ {
this.autoValidate = true; this.AutoValidate = true;
} }
/// <summary> /// <summary>
@ -222,7 +222,7 @@ namespace Stylet
// Save ourselves a little bit of work every time HasErrors is fired as the result of // Save ourselves a little bit of work every time HasErrors is fired as the result of
// the validation results changing. // the validation results changing.
if (this.validator != null && this.autoValidate && propertyName != "HasErrors") if (this.validator != null && this.AutoValidate && propertyName != "HasErrors")
await this.ValidatePropertyAsync(propertyName); await this.ValidatePropertyAsync(propertyName);
} }

View File

@ -27,8 +27,8 @@ namespace StyletUnitTests
public bool AutoValidate public bool AutoValidate
{ {
get { return base.autoValidate; } get { return base.AutoValidate; }
set { base.autoValidate = value; } set { base.AutoValidate = value; }
} }
public IModelValidator Validator public IModelValidator Validator