A practical example: I was not satisfied with the usual scroll speed of the ScrollViewer and as a result, I increased the scrolling speed by 30 times:
<ScrollViewer PreviewMouseWheel="ScrollViewer_OnPreviewMouseWheel">
And the handler:
private void ScrollViewer_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e) { var scrollViewer = sender as ScrollViewer; if (scrollViewer != null) { scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + (30 * (e.Delta > 0 ? -1 : 1))); e.Handled = true; } }
What happened (in simple terms): I intercepted the PreviewMouseWheel mouse-routed event before this event "failed" further (and would get directly to the ScrollViewer handler, which would perform scrolling at normal speed). Then I just manually scrolled the scroll (using ScrollToVerticalOffset ) by the amount of scrolling, increased by 30 times.
Since the scrolling on the fact has already been done, I do not need the event to "fail" further (which will cause the scrolling to be activated by default on the scroll side), so I use the capabilities of the routed event and prevent it from "fail" further by setting e.Handled = true .
Regarding the second question, I did not quite understand. You can use routed events of existing controls, as well as create arbitrary routed events for your controls.