简体   繁体   中英

Overwriting custom event handler of as ScrollViewer

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 when 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?

在事件处理程序中,在返回之前,将MouseWheelEventArgs参数的Handled属性设置为true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM