Back to Devexpress

RichEditControl.RemoveShortcutKey(Keys, Keys, Boolean) 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-system-dot-boolean-x29.md

latest3.3 KB
Original Source

RichEditControl.RemoveShortcutKey(Keys, Keys, Boolean) 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,
    bool updateToolTip
)
vb
Public Sub RemoveShortcutKey(
    key As Keys,
    modifier As Keys,
    updateToolTip As Boolean
)

Parameters

NameTypeDescription
keyKeys

A Keys enumeration member specifying a shortcut key.

| | modifier | Keys |

A Keys enumeration member specifying a modifier key.

| | updateToolTip | Boolean |

true, to modify a tooltip of the BarItem to which a command is assigned to remove a reference to the shortcut key; otherwise, false.

|

Remarks

The RemoveShortcutKey method override enables you to modify a tooltip of the bar item (the BarItem.SuperTip property) in the RichEdit UI so that it displays the correct shortcut information. To do this, set the updateToolTip parameter to true.

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

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

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

csharp
using System.Windows.Forms;
//...
public MainWindow()
{
    InitializeComponent();
    richEditControl.Loaded += RichEditControl_DocumentLoaded;
}

private void RichEditControl_DocumentLoaded(object sender, EventArgs e)
{
        richEditControl.RemoveShortcutKey(Keys.O, Keys.Control, true);
}
vb
Imports DevExpress.XtraRichEdit
Imports System.Windows.Forms
'...

Public Sub New()
  InitializeComponent()
  AddHandler richEditControl.Loaded, AddressOf RichEditControl_DocumentLoaded
End Sub

Private Sub RichEditControl_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs)
    richEditControl.RemoveShortcutKey(Keys.O, Keys.Control, true)
End Sub

See Also

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace