Bagikan melalui


Label.IsRequired Property

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

Gets or sets a value that indicates whether the property bound to the Target field is required.

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

Syntax

'Declaration
Public Property IsRequired As Boolean
public bool IsRequired { get; set; }
<sdk:Label IsRequired="bool"/>

Property Value

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

Remarks

Dependency property identifier field: IsRequiredProperty

By default, the Label control indicates a required field by making the caption text bold. You put the Label in the Required visual state by setting the IsRequired property to true, or by putting a RequiredAttribute on the property the Label is associated with.

If the Target property is set, the IsRequired 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.