C# Класс 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
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
ErrorMessageProperty System.Windows.DependencyProperty
RegexTextProperty System.Windows.DependencyProperty

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

GetErrorMessage() публичный статический Метод

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.
Результат string

GetRegexText() публичный статический Метод

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.
Результат string

SetErrorMessage() публичный статический Метод

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.
Результат void

SetRegexText() публичный статический Метод

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.
Результат void

Описание свойств

ErrorMessageProperty публичное статическое свойство

Identifies the RegexValidator's ErrorMessage attached property. This field is read-only.
public static DependencyProperty,System.Windows ErrorMessageProperty
Результат System.Windows.DependencyProperty

RegexTextProperty публичное статическое свойство

Identifies the RegexValidator's RegexText attached property. This field is read-only.
public static DependencyProperty,System.Windows RegexTextProperty
Результат System.Windows.DependencyProperty