INotifyDataErrorInfo.GetErrors(String) 方法

定義

取得指定之屬性或整個實體的驗證錯誤。

public:
 System::Collections::IEnumerable ^ GetErrors(System::String ^ propertyName);
public System.Collections.IEnumerable GetErrors (string propertyName);
public System.Collections.IEnumerable GetErrors (string? propertyName);
abstract member GetErrors : string -> System.Collections.IEnumerable
Public Function GetErrors (propertyName As String) As IEnumerable

參數

propertyName
String

要擷取其驗證錯誤的屬性名稱,或 nullEmpty 表示要擷取實體的錯誤。

傳回

屬性或實體的驗證錯誤。

備註

這個方法會傳 IEnumerable 回可以隨著非同步驗證規則完成處理而變更的 。 這可讓系結引擎在新增、移除或修改錯誤時自動更新使用者介面驗證意見反應。

傳回值可以變更為不同的 IEnumerable ,也可以重複使用先前傳 IEnumerable 回的 ,並變更其內容。 即使傳回值實作 INotifyCollectionChanged ,傳回值的任何變更都應該引發 ErrorsChanged 事件。

適用於