0
votes

i have a Canvas (WPF) where i can Zoom and Pan but when i want zoom in/zoom out the Canvas holding the key Ctrl + the wheel of MiddleButtonMouse in the same time also the ScrollViewer move up or down creating an undesirable effect so i ask you if there is a way meantime i zoom in/zoom out the Canvas and can make freezable the ScrollViewer without create that undesirable effect.

Thanks so much for attention

Cheers

1

1 Answers

3
votes

Subscribe to the PreviewMouseWheel event of the ScrollViewer and do e.Handled = true when you don't need it to scroll. This will prevent ScrollViewer from handling MouseWheel event.