How freeze the ScrollViewer in WPF?
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开发者_StackOverflow 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
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.
精彩评论