.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShowFontFormCommand.ForceExecute(ICommandUIState) Method

Executes the command specifying the UI state explicitly.

Namespace: DevExpress.XtraRichEdit.Commands

Assembly: DevExpress.RichEdit.v21.1.Core.dll


public override void ForceExecute(
    ICommandUIState state


Name Type Description
state ICommandUIState

An object which implements the ICommandUIState interface.


The Command.Execute method performs the UI state check implicitly, so you cannot bring the command to action arbitrarily. Unlike the Execute method, the ForceExecute method enables you to check the UI state for the command, and then deliberately and unconditionally start its execution, or decline it.

The following code sample illustrates how you can invoke the Font form for the read-only RichEdit control, to change the selection font. You can check the ICommandUIState of the command., decide whether it should be changed and change it to execute the command.

using DevExpress.Utils.Commands;
using DevExpress.XtraRichEdit.Commands;
// ...
ShowFontFormCommand cmd = new ShowFontFormCommand(richEditControl1);
ICommandUIState state = cmd.CreateDefaultCommandUIState();
if (!state.Enabled && richEditControl1.ReadOnly) state.Enabled = true;
See Also