C# Class WPF.JoshSmith.Controls.Validation.RegexValidator

This static class provides attached properties which supply validation of the text in a TextBox, using regular expressions.
Documentation: http://www.codeproject.com/KB/WPF/RegexValidationInWPF.aspx
Afficher le fichier Open project: Warewolf-ESB/Warewolf

Méthodes publiques

Свойство Type Description
ErrorMessageProperty System.Windows.DependencyProperty
RegexTextProperty System.Windows.DependencyProperty

Méthodes publiques

Méthode Description
GetErrorMessage ( TextBox textBox ) : string

Returns the error message used when validation fails for the specified TextBox.

GetRegexText ( TextBox textBox ) : string

Returns the regular expression used to validate the specified TextBox.

SetErrorMessage ( TextBox textBox, string value ) : void

Sets the error message used when validation fails for the specified TextBox.

SetRegexText ( TextBox textBox, string value ) : void

Sets the regular expression used to validate the specified TextBox.

Private Methods

Méthode Description
GetRegexValidationRuleForTextBox ( TextBox textBox ) : RegexValidationRule

Returns a RegexValidationRule to be used for validating the specified TextBox. If the TextBox is not yet initialized, this method returns null.

OnAttachedPropertyChanged ( DependencyObject depObj, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Invoked whenever an attached property of the RegexValidator is modified for a TextBox.

RegexValidator ( ) : System
VerifyRegexValidationRule ( TextBox textBox ) : void

Creates or modifies the RegexValidationRule in the TextBox's Text property binding to use the current values of the attached properties exposed by this class.

Method Details

GetErrorMessage() public static méthode

Returns the error message used when validation fails for the specified TextBox.
public static GetErrorMessage ( TextBox textBox ) : string
textBox System.Windows.Controls.TextBox The TextBox whose error message is returned.
Résultat string

GetRegexText() public static méthode

Returns the regular expression used to validate the specified TextBox.
public static GetRegexText ( TextBox textBox ) : string
textBox System.Windows.Controls.TextBox The TextBox whose regular expression is returned.
Résultat string

SetErrorMessage() public static méthode

Sets the error message used when validation fails for the specified TextBox.
public static SetErrorMessage ( TextBox textBox, string value ) : void
textBox System.Windows.Controls.TextBox The TextBox being validated.
value string The error message.
Résultat void

SetRegexText() public static méthode

Sets the regular expression used to validate the specified TextBox.
public static SetRegexText ( TextBox textBox, string value ) : void
textBox System.Windows.Controls.TextBox The TextBox being validated.
value string The regular expression.
Résultat void

Property Details

ErrorMessageProperty public_oe static_oe property

Identifies the RegexValidator's ErrorMessage attached property. This field is read-only.
public static DependencyProperty,System.Windows ErrorMessageProperty
Résultat System.Windows.DependencyProperty

RegexTextProperty public_oe static_oe property

Identifies the RegexValidator's RegexText attached property. This field is read-only.
public static DependencyProperty,System.Windows RegexTextProperty
Résultat System.Windows.DependencyProperty