开发者

How freeze the ScrollViewer in WPF?

开发者 https://www.devze.com 2023-04-08 04:15 出处:网络
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 ScrollVie

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消