So, I got this work by doing the following
public class MyScrollViewer : ScrollViewer
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control)
{
if (e.Key == Key.Left || e.Key == Key.Right)
return;
}
base.OnKeyDown(e);
}
}
I think the trick is to understand that the event starts from the top and works down. Then, along the backup path, each “layer” checks the processed logical value, and if it is not set to true, it will determine whether it will do something and set it if that happens. I needed to short-circuit this behavior for my shortcuts so that Handled would still be false when it returned to the Window level.
source
share