Validation.HasError Attached Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets a value that indicates whether any binding on the target element has a validation error.
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
See GetHasError
See GetHasError
See Remarks
Property Value
Type: System.Boolean
true if any binding on the target element has a validation error; otherwise, false.
Remarks
The Validation.HasError attached property does not have a conventional XAML usage in the form <object Validation.HasError="true" .../>. In WPF, data validation is sometimes performed with property triggers where Validation.HasError is used as a property condition to check the Property attribute value of a Trigger. Validation.HasError does appear in WPF XAML as an attribute value instead of the attribute. However, Silverlight does not use triggers in this capacity.
In Silverlight, handlers for events, such as SizeChanged, can check any pending error state. Such event handlers might check for the Validation.HasError attached property on objects in code, but would either call the GetHasError method or call the GetValue method with the HasErrorProperty identifier.
Handlers for the BindingValidationError event typically change to a particular VisualState for validation as part of their logic.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.