开发者

MouseWheel: Scrolling vs. Zooming

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 zoom开发者_如何学运维ing 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!


Looks like one of my child elements was hogging the MouseWheel event. I traced this by adding Debug.WriteLine statements to each of the child element's MouseWheel event as well as the parent control's MouseWheel event.

So, I can't blame SL4. Just myself. :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜