TreeViewControl.GetIsEditorActivationAction Event
Allows you to specify an action (key down, text input, or left mouse button click) to activate the focused editor.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v26.1.dll
Declaration
public event EventHandler<TreeViewGetIsEditorActivationActionEventArgs> GetIsEditorActivationAction
Event Data
The GetIsEditorActivationAction event's data class is TreeViewGetIsEditorActivationActionEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| ActivationAction | Gets the type of user action that triggered the editor activation check. |
| Column | Gets the column that contains the active editor cell. |
| 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. |
| IsActivationAction | Gets or sets if an in-place editor is activated for the focused cell. |
| KeyDownEventArgs |
Gets key event data if the editor activation was triggered by a keystroke; otherwise, null.
|
| MouseLeftButtonEventArgs |
Gets mouse button event data if editor activation was triggered by a mouse click; otherwise, null.
|
| 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 the handle of the row that contains the active editor cell. |
| Source | Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs. |
| TemplateChild | Gets an in-place editor specified in a cell template. |
| TextInputEventArgs |
Gets text input event data if the activation was triggered by text input; otherwise, null.
|
| Value | Gets the current value in the active editor. |
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
Handle the GetIsEditorActivationAction event to disable or enable different in-place editor activation commands depending on specific conditions. Set the e.IsActivationAction property to false within an event handler to prevent a user from activating the editor.
Example: Prevent Editor Activation on Mouse Click
The following code snippet prevents users from activating an in-place editor by accidental mouse clicks:
<dx:ThemedWindow x:Class="TreeViewControlApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Title="TreeViewControl" Height="450" Width="600">
<dxg:TreeViewControl x:Name="tree"
ChildNodesPath="Employees"
TreeViewFieldName="Name"
AllowEditing="True"
EditorShowMode="MouseUpFocused"
GetIsEditorActivationAction="OnGetIsEditorActivationAction"/>
</dx:ThemedWindow>
private void OnGetIsEditorActivationAction(object sender, TreeViewGetIsEditorActivationActionEventArgs e)
{
if (e.ActivationAction == ActivationAction.MouseLeftButtonDown || e.ActivationAction == ActivationAction.MouseLeftButtonUp)
e.IsActivationAction = false;
}
Related Events
TreeViewControl fires the following events to process user actions that activate an in-place editor:
- ProcessEditorActivationAction
- Allows you to specify whether the focused node should process an editor activation action.
- GetActiveEditorNeedsKey
- Allows you to specify whether the active editor responds to certain keystrokes.