EditingCommands Class

Provides a standard set of editing related commands.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)

public final class EditingCommands
You cannot directly create an instance of this class in XAML.

The following table shows the editing commands and the associated default key gestures (with key names from the Key and ModifierKeys enumerations).

Editing command

Default key gesture

AlignCenter

Ctrl+E

AlignJustify

Ctrl+J

AlignLeft

Ctrl+L

AlignRight

Ctrl+R

Backspace

Backspace

CorrectSpellingError

no default key gesture

DecreaseFontSize

Ctrl+OemOpenBrackets

DecreaseIndentation

Ctrl+Shift+T

Delete

Delete

DeleteNextWord

Ctrl+Delete

DeletePreviousWord

Ctrl+Backspace

EnterLineBreak

Shift+Enter

EnterParagraphBreak

Enter

IgnoreSpellingError

no default key gesture

IncreaseFontSize

Ctrl+OemCloseBrackets

IncreaseIndentation

Ctrl+T

MoveDownByLine

Down

MoveDownByPage

PageDown

MoveDownByParagraph

Ctrl+Down

MoveLeftByCharacter

Left

MoveLeftByWord

Ctrl+Left

MoveRightByCharacter

Right

MoveRightByWord

Ctrl+Right

MoveToDocumentEnd

Ctrl+End

MoveToDocumentStart

Ctrl+Home

MoveToLineEnd

End

MoveToLineStart

Home

MoveUpByLine

Up

MoveUpByPage

PageUp

MoveUpByParagraph

Ctrl+Up

SelectDownByLine

Shift+Down

SelectDownByPage

Shift+PageDown

SelectDownByParagraph

Ctrl+Shift+Down

SelectLeftByCharacter

Shift+Left

SelectLeftByWord

Ctrl+Shift+Left

SelectRightByCharacter

Shift+Right

SelectRightByWord

Ctrl+Shift+Right

SelectToDocumentEnd

Ctrl+Shift+End

SelectToDocumentStart

Ctrl+Shift+Home

SelectToLineEnd

Shift+End

SelectToLineStart

Shift+Home

SelectUpByLine

Shift+Up

SelectUpByPage

Shift+PageUp

SelectUpByParagraph

Ctrl+Shift+Up

TabBackward

Shift+Tab

TabForward

Tab

ToggleBold

Ctrl+B

ToggleBullets

Ctrl+Shift+L

ToggleInsert

Insert

ToggleItalic

Ctrl+I

ToggleNumbering

Ctrl+Shift+N

ToggleSubscript

Ctrl+OemPlus

ToggleSuperscript

Ctrl+Shift+OemPlus

ToggleUnderline

Ctrl+U

Caret movement commands and selection expanding commands share a common set of default key gestures, the general difference being the addition of the Shift key to differentiate selection commands from caret movement commands. For example, the MoveLeftByCharacter command has a default key gesture of Left, and the corresponding SelectLeftByCharacter command has a default key gesture of Shift+Left.

In general, the command definitions provided by the EditingCommands class do not make use of command parameters (the parameter parameter expected by the Execute method).

For more information on commands and commanding, see Input Overview.

The following example demonstrates how to invoke an editing command on an object that supports the command.

For this example, a RichTextBox serves as the command target. Note that RichTextBox implements the IInputElement interface (inherited from FrameworkElement), and that it includes native support for many editing commands.

The first argument for the Execute method is a command parameter. Most editing commands ignore the command parameter; in general, this parameter should be a null reference (Nothing in Visual Basic) for editing commands.

The second argument specifies the object to which the command will be routed. This object must implement the IInputElement interface, and should include a handler for the specified command. Generally, a command is ignored when invoked on an object that does not handle the command.

RichTextBox rTB = new RichTextBox();

EditingCommands.ToggleInsert.Execute(null, rTB);

System.Object
  System.Windows.Documents.EditingCommands

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft