开发者

Overwriting custom event handler of as ScrollViewer

开发者 https://www.devze.com 2023-01-06 19:18 出处:网络
I am trying to overwrite a event handler of MouseWheel for a ScrollViewer. Since ScrollViewer is sealed, I cant simply create a \"custom\" class inheriting it. I guess the generic question would be: \

I am trying to overwrite a event handler of MouseWheel for a ScrollViewer. Since ScrollViewer is sealed, I cant simply create a "custom" class inheriting it. I guess the generic question would be: "How do I overwrite the default event." (Or something like that ;-))

Edit: The event which should replace the default "scroll" only gets fired whe开发者_如何学Gon the ScrollViewer can't be scrolled or reaches a limit.


Since ScrollViewer is sealed it will be difficult to override its behavior. The ScrollChanged event only provides readonly information and can not be canceled. You might have to implement your own scroll viewer derived from ContentControl instead. What scroll behavior are you trying to implement?


In your event handler, set the Handled property of the MouseWheelEventArgs parameter to true before returning.

0

精彩评论

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

关注公众号