Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RichEditControl.AssignShortcutKeyToCommand(Keys, Keys, RichEditCommandId) Method

Assigns a shortcut key to a command. Shortcut key is available for all RichEdit views.

Namespace: DevExpress.Xpf.RichEdit

Assembly: DevExpress.Xpf.RichEdit.v24.2.dll

NuGet Package: DevExpress.Wpf.RichEdit

#Declaration

public void AssignShortcutKeyToCommand(
    Keys key,
    Keys modifier,
    RichEditCommandId commandId
)

#Parameters

Name Type Description
key Keys

A Keys enumeration member specifying a key to assign.

modifier Keys

A Keys enumeration member specifying a modifier key.

commandId RichEditCommandId

A RichEditCommandId enumeration member specifying a command.

#Remarks

Note that the RichEditControl’s shortcuts should be assigned after the control is initialized (e.g. in Window.Loaded event handler).

The code sample below assigns the Alt+Y shortcut to the CreateFieldCommand, allowing you to insert a field:

private void ThemedWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
  richEditControl1.AssignShortcutKeyToCommand(Keys.Y, Keys.Alt, RichEditCommandId.CreateField);
}

To remove a command shortcut, use the RichEditControl.RemoveShortcutKey method.

See Also