Back to Devexpress

Command.CreateDefaultCommandUIState() Method

corelibraries-devexpress-dot-utils-dot-commands-dot-command-654274bf.md

latest3.4 KB
Original Source

Command.CreateDefaultCommandUIState() Method

Creates an object defining the command state for the current command.

Namespace : DevExpress.Utils.Commands

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public virtual ICommandUIState CreateDefaultCommandUIState()
vb
Public Overridable Function CreateDefaultCommandUIState As ICommandUIState

Returns

TypeDescription
ICommandUIState

An ICommandUIState interface that defines the command state.

|

Remarks

Use the CreateDefaultCommandUIState method to create an object that exposes the ICommandUIState interface for a particular command. You can use the created object to obtain the current command state by calling the Command.UpdateUIState method. Then, you can check the command state and modify it if necessary, and call the Command.ForceExecute method to perform the action specified by the command.

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

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-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L520

csharp
RichEditCommand capCommand = richEdit.CreateCommand(RichEditCommandId.CapitalizeEachWordTextCase);
capCommand.ForceExecute(capCommand.CreateDefaultCommandUIState());

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L529

vb
Dim capCommand As RichEditCommand = richEdit.CreateCommand(RichEditCommandId.CapitalizeEachWordTextCase)
capCommand.ForceExecute(capCommand.CreateDefaultCommandUIState())

See Also

Command Class

Command Members

DevExpress.Utils.Commands Namespace