DataViewBase.GetActiveEditorNeedsKey Event

Allows you to specify whether an active editor responds to keys that an end user presses.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.Core.dll

Declaration

public event EventHandler<GetActiveEditorNeedsKeyEventArgs> GetActiveEditorNeedsKey
Public Event GetActiveEditorNeedsKey As EventHandler(Of GetActiveEditorNeedsKeyEventArgs)

Event Data

The GetActiveEditorNeedsKey event's data class is GetActiveEditorNeedsKeyEventArgs. The following properties provide information specific to this event:

Property Description
Column Gets or sets a grid column, for which an event has been raised. Inherited from EditorEventArgsBase.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
Key Gets a key an end-user presses.
Modifiers Gets a value indicating which of the modifier keys (Shift, Ctrl, and Alt) is in a pressed state.
NeedsKey Gets or sets whether an active editor responds to a key an end user presses.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
RowHandle Gets or sets the row handle, for which an event has been raised. Inherited from EditorEventArgsBase.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
TemplateChild An in-place editor specified in a cell template.
Value Gets the edit value stored in the editor, for which an event has been raised. Inherited from EditorEventArgsBase.

Remarks

Example

The following code sample shows how to make an editor respond to the Up and Down keys:

<dxg:GridControl ItemsSource="{Binding Items}">
    <dxg:GridColumn FieldName="Country"/>
    <dxg:GridColumn FieldName="City">
        <dxg:GridColumn.CellTemplate>
            <DataTemplate>
                <dxe:ListBoxEdit x:Name="PART_Editor" ItemsSource="{Binding RowData.Row.Cities}" />
            </DataTemplate>
        </dxg:GridColumn.CellTemplate>
    </dxg:GridColumn>
    <dxg:GridControl.View>
        <dxg:TableView GetActiveEditorNeedsKey="GetActiveEditorNeedsKey" />
    </dxg:GridControl.View>
</dxg:GridControl> 
private void GetActiveEditorNeedsKey(object sender, DevExpress.Xpf.Grid.GetActiveEditorNeedsKeyEventArgs e) {
    if (e.Column.FieldName == "City" && (e.Key == System.Windows.Input.Key.Up || e.Key == System.Windows.Input.Key.Down))
        e.NeedsKey = true;
} 

Process End User Actions

The GridControl provides the following events to process end user actions:

Event Description
DataViewBase.GetIsEditorActivationAction Allows you to specify whether an action (key down, text input, or mouse left button click) activates the focused editor.
DataViewBase.ProcessEditorActivationAction Allows you to make the focused editor process an activation action.
DataViewBase.GetActiveEditorNeedsKey Allows you to specify whether an active editor responds to keys that end user presses.
See Also