DataViewBase.ProcessEditorActivationAction Event

Allows you to make the focused editor process an activation action.

When a user performs an activation action, the GridControl activates the editor, but the editor does not process the action. To make the editor process the action, handle this event and set RaiseEventAgain to true.

Namespace: DevExpress.Xpf.Grid

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

Declaration

public event EventHandler<ProcessEditorActivationActionEventArgs> ProcessEditorActivationAction
Public Event ProcessEditorActivationAction As EventHandler(Of ProcessEditorActivationActionEventArgs)

Event Data

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

Property Description
ActivationAction Gets an activation action's type. Inherited from ActivationActionEventArgsBase.
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.
KeyDownEventArgs Event arguments for the KeyDown activation action. Inherited from ActivationActionEventArgsBase.
MouseLeftButtonEventArgs Event arguments for the MouseLeftButton activation action. Inherited from ActivationActionEventArgsBase.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RaiseEventAgain Gets or sets whether the event is raised again to make the focused editor process an activation action.
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. Inherited from ActivationActionEventArgsBase.
TextInputEventArgs Event arguments for the TextInput activation action. Inherited from ActivationActionEventArgsBase.
Value Gets the edit value stored in the editor, for which an event has been raised. Inherited from EditorEventArgsBase.

Remarks

An end user can activate the focused cell's in-place editor in the following ways:

  • Click the required cell
  • Press Enter
  • Press F2
  • Start typing.

To Make the Focused Editor Process an Activation Action

  1. Handle the ProcessEditorActivationAction event.
  2. Use the ActivationActionEventArgsBase.ActivationAction and ActivationActionEventArgsBase.MouseLeftButtonEventArgs / ActivationActionEventArgsBase.KeyDownEventArgs / ActivationActionEventArgsBase.TextInputEventArgs properties to get the action's information.
  3. Set the ProcessEditorActivationActionEventArgs.RaiseEventAgain property to true to make the focused editor process the activation action.

Example 1

When an end user clicks a cell, the default behavior only activates the cell editor. The GridControl grabs the click event and the editor does not receive it, so the click does not select an item inside the editor. However, you can handle the ProcessEditorActivationAction event to make the GridControl raise the click event again after handling it:

<dxg:GridControl Name="grid" 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 ProcessEditorActivationAction="TableView_ProcessEditorActivationAction" />
    </dxg:GridControl.View>
</dxg:GridControl>
void TableView_ProcessEditorActivationAction(object sender, DevExpress.Xpf.Grid.ProcessEditorActivationActionEventArgs e) {
    if (e.Column.FieldName == "City" 
     && (e.ActivationAction == ActivationAction.MouseLeftButtonDown 
      && e.MouseLeftButtonEventArgs.LeftButton == System.Windows.Input.MouseButtonState.Pressed))
        e.RaiseEventAgain = true;
}

Example 2

The following code sample shows how to make the Slider (which is specified as a custom editor) process the + and - keys after activating an editor:

void TableView_ProcessEditorActivationAction(object sender, ProcessEditorActivationActionEventArgs e) {
    if(e.Column.FieldName == "HoursActive" && e.ActivationAction == ActivationAction.KeyDown) {
        e.RaiseEventAgain = IsSliderCommand(e.KeyDownEventArgs.Key);
    }
    if(e.Column.FieldName == "HoursActive" && e.ActivationAction == ActivationAction.MouseLeftButtonDown) {
        e.RaiseEventAgain = true;
    }
}

bool IsSliderCommand(Key key) {
    switch(key) {
        case Key.Add:
        case Key.Subtract:
        case Key.OemPlus:
        case Key.OemMinus:
            return true;
        default:
            return false;
    }
}

TIP

Demo: Cell Editors

Requires installation of WPF Subscription. Download

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