INotifyDataErrorInfo.GetErrors Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the validation errors for a specified property or for the entire entity.

Namespace:  System.ComponentModel
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Function GetErrors ( _
    propertyName As String _
) As IEnumerable
IEnumerable GetErrors(
    string propertyName
)

Parameters

  • propertyName
    Type: System.String
    The name of the property to retrieve validation errors for; or nulla null reference (Nothing in Visual Basic) or Empty, to retrieve entity-level errors.

Return Value

Type: System.Collections.IEnumerable
The validation errors for the property or entity.

Remarks

This method returns an IEnumerable that can change as asynchronous validation rules finish processing. This enables the binding engine to automatically update the user interface validation feedback when errors are added, removed, or modified.

The return value can change to a different IEnumerable, or it can reuse a previously returned IEnumerable and change its contents. Any changes to the return value should raise the ErrorsChanged event, even if the return value implements INotifyCollectionChanged.

Examples

For an example of an implementation of this method, see the INotifyDataErrorInfo class overview.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.