Edit

Share via


FlowDocumentReader.OnKeyDown(KeyEventArgs) Method

Definition

Invoked whenever an unhandled KeyDown attached routed event reaches an element derived from this class in its route. Implement this method to add class handling for this event.

protected:
 override void OnKeyDown(System::Windows::Input::KeyEventArgs ^ e);
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected override void OnKeyDown (System.Windows.Input.KeyEventArgs e);
protected override void OnKeyDown (System.Windows.Input.KeyEventArgs e);
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
override this.OnKeyDown : System.Windows.Input.KeyEventArgs -> unit
override this.OnKeyDown : System.Windows.Input.KeyEventArgs -> unit
Protected Overrides Sub OnKeyDown (e As KeyEventArgs)

Parameters

e
KeyEventArgs

Provides data about the event.

Attributes

Remarks

Keystrokes are handled by a dedicated input manager. Other programming features that rely on keystrokes such as input and command bindings will potentially handle the keystroke before it is exposed as a general keystroke. If these input system features mark the event handled, then OnKeyDown will not be invoked.

This method has no default implementation. Calling base() in your implementation is still recommended, in case an intermediate class in the inheritance implemented this method. You may call base() either before or after your special handling, depending on your requirements.

The purpose of this method is somewhat similar to common language runtime (CLR) event pattern On* methods: it provides the means to handle the matching event from derived classes with a class handler instead of an instance handler. In this case the matching event is a routed event. The implementation pattern of the On* methods is different for routed events because the routed event may have been raised by a child element, not necessarily the element that will invoke handlers, so your implementation will need to take the event arguments' source properties into account (and should not try to re-raise the event in most cases). Subclasses of FlowDocumentReader could choose to call private class handler methods when the event is received along the route. One potential scenario is to take the arguments of the event and mark the event as handled.

Applies to

See also