Back to Devexpress

RichEditControl.RemoveShortcutKey(Keys, Keys) Method

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-dot-removeshortcutkey-x28-system-dot-windows-dot-forms-dot-keys-system-dot-windows-dot-forms-dot-keys-x29.md

latest2.7 KB
Original Source

RichEditControl.RemoveShortcutKey(Keys, Keys) Method

Removes a command shortcut for all RichEdit views.

Namespace : DevExpress.Xpf.RichEdit

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

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public void RemoveShortcutKey(
    Keys key,
    Keys modifier
)
vb
Public Sub RemoveShortcutKey(
    key As Keys,
    modifier As Keys
)

Parameters

NameTypeDescription
keyKeys

A Keys enumeration member specifying a shortcut key.

| | modifier | Keys |

A Keys enumeration member specifying a modifier key.

|

Remarks

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

The following example demonstrates how to remove the Ctrl+O shortcut, which allows users to load a document:

csharp
using System;
using System.Windows.Forms;

public MainWindow()
{
    InitializeComponent();
    richEditControl.Loaded += RichEditControl_DocumentLoaded;
}
//...
private void RichEditControl_Loaded(object sender, RoutedEventArgs e) {
    richEditControl.RemoveShortcutKey(Keys.O, Control);
}
vb
Imports System
Imports System.Windows.Forms

Public Sub New()
  InitializeComponent()
  richEditControl.Loaded += RichEditControl_DocumentLoaded
End Sub
'...

Private Sub RichEditControl_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    richEditControl.RemoveShortcutKey(Keys.O, Keys.Control)
End Sub

To assign a command shortcut, use the RichEditControl.AssignShortcutKeyToCommand method.

See Also

AssignShortcutKeyToCommand

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace