Back to Devexpress

PropertyGridControl.GetActiveEditorNeedsKey Event

wpf-devexpress-dot-xpf-dot-propertygrid-dot-propertygridcontrol-cc8302c3.md

latest7.4 KB
Original Source

PropertyGridControl.GetActiveEditorNeedsKey Event

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

Namespace : DevExpress.Xpf.PropertyGrid

Assembly : DevExpress.Xpf.PropertyGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PropertyGrid

Declaration

csharp
public event EventHandler<GetActiveEditorNeedsKeyEventArgs> GetActiveEditorNeedsKey
vb
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:

PropertyDescription
HandledGets 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.
KeyGets the key the user is pressing.
ModifiersGets the modifier keys (Shift, Ctrl, and Alt) the user is pressing.
NeedsKeyGets or sets whether an active editor responds to the key the user is pressing.
OriginalSourceGets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
RowGets a property grid row. Inherited from PropertyGridRowBaseEventArgs.
SourceGets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
TemplateChildGets an in-place editor specified in a cell template.
ValueGets a row’s value. Inherited from PropertyGridRowBaseEventArgs.

The event data class exposes the following methods:

MethodDescription
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

The PropertyGridControl processes keys a user presses even if the in-place editor is active. For example, arrow keys move focus between rows. The GetActiveEditorNeedsKey event allows you to specify keys that are processed by the active in-place editor instead of the PropertyGridControl.

The following code sample allows users to use the arrow keys to navigate within the ListBoxEdit in-place editor:

csharp
using System.Windows.Input;

// ...

void OnGetActiveEditorNeedsKey(object sender, DevExpress.Xpf.PropertyGrid.GetActiveEditorNeedsKeyEventArgs e) {
    if (e.Key == Key.Up || e.Key == Key.Down || e.Key == Key.Left || e.Key == Key.Right)
        e.NeedsKey = true;
}
vb
Imports System.Windows.Input

' ...

Private Sub OnGetActiveEditorNeedsKey(ByVal sender As Object, ByVal e As DevExpress.Xpf.PropertyGrid.GetActiveEditorNeedsKeyEventArgs)
    If e.Key = Key.Up OrElse e.Key = Key.Down OrElse e.Key = Key.Left OrElse e.Key = Key.Right Then e.NeedsKey = True
End Sub

Process User Actions

The PropertyGridControl includes the following events that allow you to specify how users can interact with editors:

EventDescription
GetIsEditorActivationActionAllows you to specify whether an action (key down, text input, or mouse left button click) activates the focused editor.
ProcessEditorActivationActionAllows you to prohibit the focused editor to process an activation action.
GetActiveEditorNeedsKeyAllows you to specify whether an active editor responds to keys that a user presses.

See Also

Customize Properties

PropertyGridControl Class

PropertyGridControl Members

DevExpress.Xpf.PropertyGrid Namespace