C# Class WinRTXamlToolkit.Controls.Extensions.FieldValidationExtensions

Attached properties for handling basic validation of field values.
ファイルを表示 Open project: xyzzer/WinRTXamlToolkit Class Usage Examples

Public Properties

Property Type Description
DefaultErrorMessageProperty Windows.UI.Xaml.DependencyProperty
FormatProperty Windows.UI.Xaml.DependencyProperty
FormatValidationHandlerProperty Windows.UI.Xaml.DependencyProperty
InvalidBrushProperty Windows.UI.Xaml.DependencyProperty
IsValidProperty Windows.UI.Xaml.DependencyProperty
MinLengthErrorMessageProperty Windows.UI.Xaml.DependencyProperty
MinLengthProperty Windows.UI.Xaml.DependencyProperty
NonEmptyErrorMessageProperty Windows.UI.Xaml.DependencyProperty
NumericErrorMessageProperty Windows.UI.Xaml.DependencyProperty
PatternErrorMessageProperty Windows.UI.Xaml.DependencyProperty
PatternProperty Windows.UI.Xaml.DependencyProperty
SpecificLengthErrorMessageProperty Windows.UI.Xaml.DependencyProperty
ValidBrushProperty Windows.UI.Xaml.DependencyProperty
ValidationMessageProperty Windows.UI.Xaml.DependencyProperty
ValidationMessageVisibilityProperty Windows.UI.Xaml.DependencyProperty

Public Methods

Method Description
GetDefaultErrorMessage ( DependencyObject d ) : string

Gets the DefaultErrorMessage property. This dependency property indicates the field value is invalid.

GetFormat ( DependencyObject d ) : ValidationChecks

Gets the Format property. This dependency property indicates the formats to validate for.

GetInvalidBrush ( DependencyObject d ) : Brush

Gets the InvalidBrush property. This dependency property indicates the brush to use to highlight a field with invalid value.

GetIsValid ( DependencyObject d ) : bool

Gets the IsValid property. This dependency property indicates whether the field value is valid.

GetMinLength ( DependencyObject d ) : int

Gets the MinLength property. This dependency property indicates minimum expected field value length if MinLength format is set.

The default value is 8 which matches a typical requirement for minimum password length. Specify another value if 8 is not the minimum value you expect when you set ValidationChecks.MinLength.

GetMinLengthErrorMessage ( DependencyObject d ) : string

Gets the MinLengthErrorMessage property. This dependency property indicates the error message to use for field that doesn't match minimum length requirement.

GetNonEmptyErrorMessage ( DependencyObject d ) : string

Gets the NonEmptyErrorMessage property. This dependency property indicates the error message to use when the field is marked non-empty and is empty.

GetNumericErrorMessage ( DependencyObject d ) : string

Gets the NumericErrorMessage property. This dependency property indicates the error message to use for a field marked numeric with non-numeric content.

GetPattern ( DependencyObject d ) : string

Gets the Pattern property. This dependency property indicates the regex pattern that the Text property needs to match.

GetPatternErrorMessage ( DependencyObject d ) : string

Gets the PatternErrorMessage property. This dependency property indicates the error message to use when the field text doesn't match requested pattern.

GetSpecificLengthErrorMessage ( DependencyObject d ) : string

Gets the SpecificLengthErrorMessage property. This dependency property indicates the error message to use for a field with an incorrect number of characters.

GetValidBrush ( DependencyObject d ) : Brush

Gets the ValidBrush property. This dependency property indicates the brush to use to highlight a successfully validated field.

GetValidationMessage ( DependencyObject d ) : string

Gets the ValidationMessage property. This dependency property indicates the validation error message if the value is not valid.

GetValidationMessageVisibility ( DependencyObject d ) : Visibility

Gets the ValidationMessageVisibility property. This dependency property indicates the visibility of the validation message.

SetDefaultErrorMessage ( DependencyObject d, string value ) : void

Sets the DefaultErrorMessage property. This dependency property indicates the field value is invalid.

SetFormat ( DependencyObject d, ValidationChecks value ) : void

Sets the Format property. This dependency property indicates the formats to validate for.

SetInvalidBrush ( DependencyObject d, Brush value ) : void

Sets the InvalidBrush property. This dependency property indicates the brush to use to highlight a field with invalid value.

SetIsValid ( DependencyObject d, bool value ) : void

Sets the IsValid property. This dependency property indicates whether the field value is valid.

SetMinLength ( DependencyObject d, int value ) : void

Sets the MinLength property. This dependency property indicates minimum expected field value length if MinLength format is set.

SetMinLengthErrorMessage ( DependencyObject d, string value ) : void

Sets the MinLengthErrorMessage property. This dependency property indicates the error message to use for field that doesn't match minimum length requirement.

SetNonEmptyErrorMessage ( DependencyObject d, string value ) : void

Sets the NonEmptyErrorMessage property. This dependency property indicates the error message to use when the field is marked non-empty and is empty.

SetNumericErrorMessage ( DependencyObject d, string value ) : void

Sets the NumericErrorMessage property. This dependency property indicates the error message to use for a field marked numeric with non-numeric content.

SetPattern ( DependencyObject d, string value ) : void

Sets the Pattern property. This dependency property indicates the regex pattern that the Text property needs to match.

SetPatternErrorMessage ( DependencyObject d, string value ) : void

Sets the PatternErrorMessage property. This dependency property indicates the error message to use when the field text doesn't match requested pattern.

SetSpecificLengthErrorMessage ( DependencyObject d, string value ) : void

Sets the SpecificLengthErrorMessage property. This dependency property indicates the error message to use for a field with an incorrect number of characters.

SetValidBrush ( DependencyObject d, Brush value ) : void

Sets the ValidBrush property. This dependency property indicates the brush to use to highlight a successfully validated field.

SetValidationMessage ( DependencyObject d, string value ) : void

Sets the ValidationMessage property. This dependency property indicates the validation error message if the value is not valid.

SetValidationMessageVisibility ( DependencyObject d, Visibility value ) : void

Sets the ValidationMessageVisibility property. This dependency property indicates the visibility of the validation message.

Private Methods

Method Description
GetFormatValidationHandler ( DependencyObject d ) : object
OnDefaultErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the DefaultErrorMessage property.

OnFormatChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the Format property.

OnFormatValidationHandlerChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the FormatValidationHandler property.

OnInvalidBrushChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the InvalidBrush property.

OnMinLengthChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the MinLength property.

OnMinLengthErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the MinLengthErrorMessage property.

OnNonEmptyErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the NonEmptyErrorMessage property.

OnNumericErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the NumericErrorMessage property.

OnPatternChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the Pattern property.

OnPatternErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the PatternErrorMessage property.

OnSpecificLengthErrorMessageChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the SpecificLengthErrorMessage property.

OnValidBrushChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void

Handles changes to the ValidBrush property.

SetFormatValidationHandler ( DependencyObject d, object value ) : void
SetupAndValidate ( DependencyObject dependencyObject ) : void

Method Details

GetDefaultErrorMessage() public static method

Gets the DefaultErrorMessage property. This dependency property indicates the field value is invalid.
public static GetDefaultErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetFormat() public static method

Gets the Format property. This dependency property indicates the formats to validate for.
public static GetFormat ( DependencyObject d ) : ValidationChecks
d Windows.UI.Xaml.DependencyObject
return ValidationChecks

GetInvalidBrush() public static method

Gets the InvalidBrush property. This dependency property indicates the brush to use to highlight a field with invalid value.
public static GetInvalidBrush ( DependencyObject d ) : Brush
d Windows.UI.Xaml.DependencyObject
return Windows.UI.Xaml.Media.Brush

GetIsValid() public static method

Gets the IsValid property. This dependency property indicates whether the field value is valid.
public static GetIsValid ( DependencyObject d ) : bool
d Windows.UI.Xaml.DependencyObject
return bool

GetMinLength() public static method

Gets the MinLength property. This dependency property indicates minimum expected field value length if MinLength format is set.
The default value is 8 which matches a typical requirement for minimum password length. Specify another value if 8 is not the minimum value you expect when you set ValidationChecks.MinLength.
public static GetMinLength ( DependencyObject d ) : int
d Windows.UI.Xaml.DependencyObject
return int

GetMinLengthErrorMessage() public static method

Gets the MinLengthErrorMessage property. This dependency property indicates the error message to use for field that doesn't match minimum length requirement.
public static GetMinLengthErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetNonEmptyErrorMessage() public static method

Gets the NonEmptyErrorMessage property. This dependency property indicates the error message to use when the field is marked non-empty and is empty.
public static GetNonEmptyErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetNumericErrorMessage() public static method

Gets the NumericErrorMessage property. This dependency property indicates the error message to use for a field marked numeric with non-numeric content.
public static GetNumericErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetPattern() public static method

Gets the Pattern property. This dependency property indicates the regex pattern that the Text property needs to match.
public static GetPattern ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetPatternErrorMessage() public static method

Gets the PatternErrorMessage property. This dependency property indicates the error message to use when the field text doesn't match requested pattern.
public static GetPatternErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetSpecificLengthErrorMessage() public static method

Gets the SpecificLengthErrorMessage property. This dependency property indicates the error message to use for a field with an incorrect number of characters.
public static GetSpecificLengthErrorMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetValidBrush() public static method

Gets the ValidBrush property. This dependency property indicates the brush to use to highlight a successfully validated field.
public static GetValidBrush ( DependencyObject d ) : Brush
d Windows.UI.Xaml.DependencyObject
return Windows.UI.Xaml.Media.Brush

GetValidationMessage() public static method

Gets the ValidationMessage property. This dependency property indicates the validation error message if the value is not valid.
public static GetValidationMessage ( DependencyObject d ) : string
d Windows.UI.Xaml.DependencyObject
return string

GetValidationMessageVisibility() public static method

Gets the ValidationMessageVisibility property. This dependency property indicates the visibility of the validation message.
public static GetValidationMessageVisibility ( DependencyObject d ) : Visibility
d Windows.UI.Xaml.DependencyObject
return Visibility

SetDefaultErrorMessage() public static method

Sets the DefaultErrorMessage property. This dependency property indicates the field value is invalid.
public static SetDefaultErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetFormat() public static method

Sets the Format property. This dependency property indicates the formats to validate for.
public static SetFormat ( DependencyObject d, ValidationChecks value ) : void
d Windows.UI.Xaml.DependencyObject
value ValidationChecks
return void

SetInvalidBrush() public static method

Sets the InvalidBrush property. This dependency property indicates the brush to use to highlight a field with invalid value.
public static SetInvalidBrush ( DependencyObject d, Brush value ) : void
d Windows.UI.Xaml.DependencyObject
value Windows.UI.Xaml.Media.Brush
return void

SetIsValid() public static method

Sets the IsValid property. This dependency property indicates whether the field value is valid.
public static SetIsValid ( DependencyObject d, bool value ) : void
d Windows.UI.Xaml.DependencyObject
value bool
return void

SetMinLength() public static method

Sets the MinLength property. This dependency property indicates minimum expected field value length if MinLength format is set.
public static SetMinLength ( DependencyObject d, int value ) : void
d Windows.UI.Xaml.DependencyObject
value int
return void

SetMinLengthErrorMessage() public static method

Sets the MinLengthErrorMessage property. This dependency property indicates the error message to use for field that doesn't match minimum length requirement.
public static SetMinLengthErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetNonEmptyErrorMessage() public static method

Sets the NonEmptyErrorMessage property. This dependency property indicates the error message to use when the field is marked non-empty and is empty.
public static SetNonEmptyErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetNumericErrorMessage() public static method

Sets the NumericErrorMessage property. This dependency property indicates the error message to use for a field marked numeric with non-numeric content.
public static SetNumericErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetPattern() public static method

Sets the Pattern property. This dependency property indicates the regex pattern that the Text property needs to match.
public static SetPattern ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetPatternErrorMessage() public static method

Sets the PatternErrorMessage property. This dependency property indicates the error message to use when the field text doesn't match requested pattern.
public static SetPatternErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetSpecificLengthErrorMessage() public static method

Sets the SpecificLengthErrorMessage property. This dependency property indicates the error message to use for a field with an incorrect number of characters.
public static SetSpecificLengthErrorMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetValidBrush() public static method

Sets the ValidBrush property. This dependency property indicates the brush to use to highlight a successfully validated field.
public static SetValidBrush ( DependencyObject d, Brush value ) : void
d Windows.UI.Xaml.DependencyObject
value Windows.UI.Xaml.Media.Brush
return void

SetValidationMessage() public static method

Sets the ValidationMessage property. This dependency property indicates the validation error message if the value is not valid.
public static SetValidationMessage ( DependencyObject d, string value ) : void
d Windows.UI.Xaml.DependencyObject
value string
return void

SetValidationMessageVisibility() public static method

Sets the ValidationMessageVisibility property. This dependency property indicates the visibility of the validation message.
public static SetValidationMessageVisibility ( DependencyObject d, Visibility value ) : void
d Windows.UI.Xaml.DependencyObject
value Visibility
return void

Property Details

DefaultErrorMessageProperty public_oe static_oe property

DefaultErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml DefaultErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

FormatProperty public_oe static_oe property

Format Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml FormatProperty
return Windows.UI.Xaml.DependencyProperty

FormatValidationHandlerProperty public_oe static_oe property

FormatValidationHandler Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml FormatValidationHandlerProperty
return Windows.UI.Xaml.DependencyProperty

InvalidBrushProperty public_oe static_oe property

InvalidBrush Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml InvalidBrushProperty
return Windows.UI.Xaml.DependencyProperty

IsValidProperty public_oe static_oe property

IsValid Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml IsValidProperty
return Windows.UI.Xaml.DependencyProperty

MinLengthErrorMessageProperty public_oe static_oe property

MinLengthErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml MinLengthErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

MinLengthProperty public_oe static_oe property

MinLength Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml MinLengthProperty
return Windows.UI.Xaml.DependencyProperty

NonEmptyErrorMessageProperty public_oe static_oe property

NonEmptyErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml NonEmptyErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

NumericErrorMessageProperty public_oe static_oe property

NumericErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml NumericErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

PatternErrorMessageProperty public_oe static_oe property

PatternErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml PatternErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

PatternProperty public_oe static_oe property

Pattern Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml PatternProperty
return Windows.UI.Xaml.DependencyProperty

SpecificLengthErrorMessageProperty public_oe static_oe property

SpecificLengthErrorMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml SpecificLengthErrorMessageProperty
return Windows.UI.Xaml.DependencyProperty

ValidBrushProperty public_oe static_oe property

ValidBrush Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml ValidBrushProperty
return Windows.UI.Xaml.DependencyProperty

ValidationMessageProperty public_oe static_oe property

ValidationMessage Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml ValidationMessageProperty
return Windows.UI.Xaml.DependencyProperty

ValidationMessageVisibilityProperty public_oe static_oe property

ValidationMessageVisibility Attached Dependency Property
public static DependencyProperty,Windows.UI.Xaml ValidationMessageVisibilityProperty
return Windows.UI.Xaml.DependencyProperty