Condividi tramite


Control.IsEnabled Property

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

Gets or sets a value indicating whether the user can interact with the control.

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

Syntax

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

Property Value

Type: System.Boolean
true if the user can interact with the control; otherwise, false.

Remarks

Dependency property identifier field: IsEnabledProperty

When IsEnabled is false, a control cannot have focus or receive input events, such as MouseLeftButtonDown. A control inherits the IsEnabled property from its parent control. For example, if a control that contains a button has IsEnabled set to false, the button's IsEnabled property is also false.

A parent element of a disabled Control will be visible to hit testing. For example, if a Canvas contains a Button that has its IsEnabled property is false, when the user clicks the Button, the Button does not receive the Click event, but the Canvas receives the MouseLeftButtonDown event.

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.