DataViewBase.ProcessEditorActivationAction Event
Allows you to specify whether the focused editor should process an activation action.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.Core.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
public event EventHandler<ProcessEditorActivationActionEventArgs> ProcessEditorActivationAction
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. |
The event data class exposes the following methods:
Method | Description |
---|---|
InvokeEventHandler(Delegate, Object) | When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs. |
OnSetSource(Object) | When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs. |
Remarks
A user can activate the focused cell’s in-place editor in the following ways:
- Click the required cell
- Press Enter
- Press F2
- Start typing.
When a user activates a cell editor, the default behavior passes the activation action to the editor. In some cases (for example, if you use a combination of CellDisplayTemplate and CellEditTemplate properties), the GridControl does not pass the action. You can use the ProcessEditorActivationAction
event to change this behavior.
To Make the Focused Editor Process an Activation Action
- Handle the
ProcessEditorActivationAction
event. - Use the ActivationAction and MouseLeftButtonEventArgs / KeyDownEventArgs / TextInputEventArgs properties to get the action’s information.
- Set the RaiseEventAgain property to
true
to make the focused editor process the activation action.
Example 1
The following code sample demonstrates how to implement navigation in custom cell editors:
<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;
}
}
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 a user presses. |
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ProcessEditorActivationAction event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.