Share via


Label.IsValid Property

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

Gets a value that indicates whether the Target field data is valid.

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

Syntax

'Declaration
Public Property IsValid As Boolean
public bool IsValid { get; private set; }

Property Value

Type: System.Boolean
true if the field data is valid; otherwise, false. The default is true.

Remarks

Dependency property identifier field: IsValidProperty

By default, the Label control indicates a validation error by making the caption text red. When the Target property is set, a Label responds to the BindingValidationError event for the Target control. It changes to its Invalid visual state when an error occurs, and to its Valid visual state when the error is resolved. In order to receive error notifications, you must set the ValidatesOnExceptions and NotifyOnValidationError properties on the Target controls Binding to true.

If the Target property is set, the IsValid property will be reset to the value in the Target control's metadata when the Refresh method is called.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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