Skip to main content

Commands

A RoutedCommand provides the signaling mechanism that indicates that a particular action is required; it is simply a messaging mechanism and does not perform the actions for the command. Routed commands can be triggered on an element through gestures attached to a command, through an InputBinding on a specific element, or explicitly (invoked directly).

The following table provides a list of the commands that are exposed through the static DataGridCommands class:

CommandDescription
BeginEditRepresents the BeginEdit command, which requests the row enters edit mode. By default, F2.
CancelEditRepresents the CancelEdit command, which requests that row exit edit mode and any changes be discarded. By default, Escape.
CollapseDetailsRepresents the CollapseDetails command, which requests that the associated detail and its possible child details be collapsed. By default, the Left arrow key.
CollapseGroupRepresents the CollapseGroup command, which requests that the associated group be collapsed. By default, the Left arrow key.
EndEditRepresents the EndEdit command, which requests that the row exit edit mode. By default, Enter.
ExpandDetailsRepresents the ExpandDetails command, which requests that the associated detail and its possible child details be expanded. By default, the Right arrow key.
ExpandGroupRepresents the ExpandGroup command, which requests that the associated group be expanded. By default, the Right arrow key.
ToggleDetailExpansionRepresents the ToggleDetailExpansion command, which requests that the associated detail and its possible child details be collapsed if the root detail is expanded, and expanded if the root detail is collapsed. By default, Space or double-clicking the left mouse button.
ToggleGroupExpansionRepresents the ToggleGroupExpansion command, which requests that the associated group be collapsed if it is expanded, and expanded if it is collapsed. By default, Space or double-clicking the left mouse button.