When a routed event in WPF is being routed up or down the hierarchy of elements, an element that handles a particular event can choose to optionally mark the event as handled, by setting the KeyEventArgs.Handled property to true. Normally, this short-circuits the routing of the event and elements further up (or down) the tree will not see the event.
But you can choose to override this default behavior, setting up an event handler that will get called even when the underlying event has been handled.
You can ask to by notified of handled events by adding an event in code, rather than declaring it in XAML. The third parameter indicates that this handler should be called even when the event has already been marked as handled.
public MainWindow() { this.InitializeComponent(); spMain.AddHandler(UIElement.KeyDownEvent, (KeyEventHandler)spMain_KeyDown, true); }
Image may be NSFW.
Clik here to view.
Filed under: Events Tagged: Events, Handled, Routed Events, WPF Image may be NSFW.
Clik here to view.

Clik here to view.
