corelibraries-devexpress-dot-utils-dot-commands-dot-icommanduistate-488ed18f.md
Gets or sets whether the command is enabled.
Namespace : DevExpress.Utils.Commands
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
bool Enabled { get; set; }
Property Enabled As Boolean
| Type | Description |
|---|---|
| Boolean |
true to enable the command; otherwise, false.
|
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
// 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
' Disable the command if the document has less than 5 paragraphs.
state.Enabled = Control.Document.Paragraphs.Count > 5
End Sub
See Also