Back to Devexpress

Command.ForceExecute(ICommandUIState) Method

corelibraries-devexpress-dot-utils-dot-commands-dot-command-dot-forceexecute-x28-devexpress-dot-utils-dot-commands-dot-icommanduistate-x29.md

latest3.7 KB
Original Source

Command.ForceExecute(ICommandUIState) Method

Performs a command action regardless of a command state.

Namespace : DevExpress.Utils.Commands

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public abstract void ForceExecute(
    ICommandUIState state
)
vb
Public MustOverride Sub ForceExecute(
    state As ICommandUIState
)

Parameters

NameTypeDescription
stateICommandUIState

An ICommandUIState interface defining the command state.

|

Remarks

The following code snippet illustrates the typical use of the ForceExecute method.

csharp
using DevExpress.Utils.Commands;
// ...
ICommandUIState state = cmd.CreateDefaultCommandUIState();
cmd.UpdateUIState(state);
// check command state 
if (state.Enabled)
{
    cmd.ForceExecute(state);
}
vb
Imports DevExpress.Utils.Commands
' ...
Private state As ICommandUIState = cmd.CreateDefaultCommandUIState()
cmd.UpdateUIState(state)
' check command state 
If state.Enabled Then
    cmd.ForceExecute(state)
End If

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ForceExecute(ICommandUIState) 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

Execute()

CreateDefaultCommandUIState()

UpdateUIState(ICommandUIState)

Command Class

Command Members

DevExpress.Utils.Commands Namespace