MouseWheel: Scrolling vs. Zooming

Posted by beaudetious on Stack Overflow See other posts from Stack Overflow or by beaudetious
Published on 2010-04-28T15:07:51Z Indexed on 2010/04/28 15:33 UTC
Read the original article Hit count: 437

I've got a Silverlight 4 custom control that basically is several Canvas elements wrapped inside a ScrollViewer. The user can set a property to determine whether to scroll or zoom when using their mouses wheel. In the custom control's MouseWheel event, I check to see if they want to scroll or zoom. If zooming, I determine the delta and modify the custom control's zoom level (which then handles the zooming code for me).

The problem is that zooming won't start until the ScrollViewer's current position of the vertical scrollbar is at the top or bottom of the scrollbar. Once their, then the zooming works perfectly.

Does anyone have any suggestions on how I can prevent scrolling completely so that I only zoom (when the user wants to zoom, that is)?

Thanks!

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-4.0