INotifyDataErrorInfo 介面

定義

定義資料實體類別可實作以提供自訂同步和非同步驗證支援的成員。Defines members that data entity classes can implement to provide custom synchronous and asynchronous validation support.

public interface class INotifyDataErrorInfo
public interface INotifyDataErrorInfo
type INotifyDataErrorInfo = interface
Public Interface INotifyDataErrorInfo

備註

這個介面可讓資料實體類別執行自訂驗證規則,並以非同步方式公開驗證結果。This interface enables data entity classes to implement custom validation rules and expose validation results asynchronously. 此介面也支援自訂錯誤物件、每個屬性多個錯誤、跨屬性錯誤,以及實體層級錯誤。This interface also supports custom error objects, multiple errors per property, cross-property errors, and entity-level errors. 交互屬性錯誤是影響多個屬性的錯誤。Cross-property errors are errors that affect multiple properties. 您可以將這些錯誤與一個或所有受影響的屬性產生關聯,也可以將它們視為實體層級錯誤。You can associate these errors with one or all of the affected properties, or you can treat them as entity-level errors. 實體層級的錯誤是會影響多個屬性或影響整個實體,而不會影響特定屬性的錯誤。Entity-level errors are errors that either affect multiple properties or affect the entire entity without affecting a particular property.

屬性

HasErrors

取得值,這個值表示實體是否有驗證錯誤。Gets a value that indicates whether the entity has validation errors.

方法

GetErrors(String)

取得指定之屬性或整個實體的驗證錯誤。Gets the validation errors for a specified property or for the entire entity.

事件

ErrorsChanged

當屬性或整個實體的驗證錯誤已變更時發生。Occurs when the validation errors have changed for a property or for the entire entity.

適用於