Reputation: 5929
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.
Upvotes: 0
Views: 378
Reputation: 9677
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?
Upvotes: 1
Reputation: 103485
In your event handler, set the Handled
property of the MouseWheelEventArgs parameter to true
before returning.
Upvotes: 0