Back to Devexpress

ICommandUIState.Enabled Property

corelibraries-devexpress-dot-utils-dot-commands-dot-icommanduistate-488ed18f.md

latest2.7 KB
Original Source

ICommandUIState.Enabled Property

Gets or sets whether the command is enabled.

Namespace : DevExpress.Utils.Commands

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
bool Enabled { get; set; }
vb
Property Enabled As Boolean

Property Value

TypeDescription
Boolean

true to enable the command; otherwise, false.

|

Remarks

The Enabled property value is used by the Command.CanExecute method to decide whether the command can be executed. User interface elements supporting commands handle the Enabled property by changing their state accordingly.

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-richedit-replace-standard-command-with-custom-command/CS/CustomCommand/Form1.cs#L57

csharp
// Disable the command if the document has less than 5 paragraphs.
    state.Enabled = Control.Document.Paragraphs.Count > 5;
}

winforms-richedit-replace-standard-command-with-custom-command/VB/CustomCommand/Form1.vb#L65

vb
' Disable the command if the document has less than 5 paragraphs.
    state.Enabled = Control.Document.Paragraphs.Count > 5
End Sub

See Also

ICommandUIState Interface

ICommandUIState Members

DevExpress.Utils.Commands Namespace