Compartilhar via


Binding.ValidatesOnExceptions Property

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

Gets or sets a value that indicates whether the binding engine will report exception validation errors.

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

Syntax

'Declaration
Public Property ValidatesOnExceptions As Boolean
public bool ValidatesOnExceptions { get; set; }
<Binding ValidatesOnExceptions="bool"/>

Property Value

Type: System.Boolean
true if the binding engine will report exception validation errors; otherwise, false. The default is false.

Exceptions

Exception Condition
InvalidOperationException

The Binding has already been attached to a target element, and cannot be modified.

Remarks

Setting ValidatesOnExceptions to true tells the binding engine to catch exceptions that occur when updating the source object from the target in TwoWay bindings. The exceptions can occur in two ways:

1. Thrown from the source object's setter function.

2. Thrown by the type converter.

In order to receive notification that these exceptions have occurred, you must set the NotifyOnValidationError property to be true.

If this property is set to false, the application will silently fail on validation exceptions.

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.