DataErrorValidationRule 類別

定義

表示檢查錯誤的規則,這些錯誤由來源物件的 IDataErrorInfo 實作所引發。Represents a rule that checks for errors that are raised by the IDataErrorInfo implementation of the source object.

public ref class DataErrorValidationRule sealed : System::Windows::Controls::ValidationRule
public sealed class DataErrorValidationRule : System.Windows.Controls.ValidationRule
type DataErrorValidationRule = class
    inherit ValidationRule
Public NotInheritable Class DataErrorValidationRule
Inherits ValidationRule
繼承
DataErrorValidationRule

備註

WPFWPF 資料系結模型可讓您將 ValidationRulesBinding 物件建立關聯。The WPFWPF data binding model enables you to associate ValidationRules with a Binding object. 如果您的來源物件會執行 IDataErrorInfo 介面,您可以使用內建的規則 DataErrorValidationRule 來檢查 IDataErrorInfo 執行所引發的錯誤。If your source object implements the IDataErrorInfo interface, you can use the built-in rule DataErrorValidationRule to check for errors raised by the IDataErrorInfo implementation.

明確設定 DataErrorValidationRule 的替代語法,是將 ValidatesOnDataErrors 屬性設定為 BindingMultiBinding 物件上的 trueAn alternative syntax to setting the DataErrorValidationRule explicitly is to set the ValidatesOnDataErrors property to true on your Binding or MultiBinding object.

您可以藉由建立衍生自 ValidationRule的類別來建立自訂規則。You can create a custom rule by creating a class that derives from ValidationRule. 如需資料驗證的詳細資訊和詳細討論,請參閱資料系結總覽For more information and a detailed discussion of data validation, see Data Binding Overview.

.NET Framework 3.5 版中引進了 DataErrorValidationRuleDataErrorValidationRule is introduced in the .NET Framework version 3.5. 如需詳細資訊,請參閱版本和相依性For more information, see Versions and Dependencies.

建構函式

DataErrorValidationRule()

DataErrorValidationRule 類別的新執行個體初始化。Initializes a new instance of the DataErrorValidationRule class.

屬性

ValidatesOnTargetUpdated

取得或設定值,這個值表示是否在 Binding 的目標更新值執行驗證規則。Gets or sets a value that indicates whether the validation rule runs when the target of the Binding is updated.

(繼承來源 ValidationRule)
ValidationStep

取得或設定執行驗證規則的時機。Gets or sets when the validation rule runs.

(繼承來源 ValidationRule)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
Validate(Object, CultureInfo)

在值上執行驗證檢查。Performs validation checks on a value.

Validate(Object, CultureInfo, BindingExpressionBase)

在值上執行驗證檢查。Performs validation checks on a value.

(繼承來源 ValidationRule)
Validate(Object, CultureInfo, BindingGroup)

在值上執行驗證檢查。Performs validation checks on a value.

(繼承來源 ValidationRule)

適用於

另請參閱