Back to Devexpress

EditorButton.Enabled Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-editorbutton-f14f6750.md

latest4.0 KB
Original Source

EditorButton.Enabled Property

Gets or sets the Boolean value that determines whether a user can perform actions on the current editor button.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(true)]
[DXCategory("Behavior")]
public virtual bool Enabled { get; set; }
vb
<DefaultValue(True)>
<DXCategory("Behavior")>
Public Overridable Property Enabled As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true if an editor button is enabled and a user can perform actions on it; otherwise, false.

|

Remarks

Use the Enabled property to temporarily disable the current button. The disabled button is displayed grayed and does not react to mouse events. If the button is disabled a user cannot press/click it to invoke its functionality, i.e. the RepositoryItemButtonEdit.ButtonClick and RepositoryItemButtonEdit.ButtonPressed events are not fired when clicking the button. Also when pressing the shortcut associated with the button via the EditorButton.Shortcut property, the ButtonClick event is not fired.

If Enabled is set to true , the button functions as it would normally.

When the property value changes, the button’s EditorButton.Changed event is fired.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Enabled property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-toggle-row-visibility/CS/WindowsApplication1/Form1.cs#L45

csharp
EditorButton button = spinEdit1.Properties.Buttons[1];
button.Enabled = !(spinEdit1.EditValue == null);
button.Caption = rowVisibilityHelper1.IsRowInvisible(GetButtonEditValue()) ? "Show" : "Hide";

winforms-grid-toggle-row-visibility/VB/WindowsApplication1/Form1.vb#L42

vb
Dim button As EditorButton = spinEdit1.Properties.Buttons(1)
button.Enabled = Not(spinEdit1.EditValue Is Nothing)
If rowVisibilityHelper1.IsRowInvisible(GetButtonEditValue()) Then

See Also

ButtonClick

ButtonPressed

Changed

EditorButton Class

EditorButton Members

DevExpress.XtraEditors.Controls Namespace