I can bind to Ctrl+C or Ctrl+LeftClick, but how can I bind to mouse/scroll wheel actions?
I am trying to do something like increase/decrease font size, like in a browser.
I want to set Ctrl+MWheelUp to the increase font size
In constructor add event to PreviewMouseWheel
PreviewMouseWheel += Window_PreviewMouseWheel;
And then in the handler detect the key
private void Window_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (Keyboard.Modifiers != ModifierKeys.Control)
return;
if (e.Delta > 0)
ZoomIn();
else if (e.Delta < 0)
ZoomOut();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With