Created
February 29, 2016 20:33
-
-
Save joemaidman/29d789542244269110b5 to your computer and use it in GitHub Desktop.
WPF bubble up visual tree to allow scroll over control with own scrollviewer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controlName.PreviewMouseWheel += PreviewMouseWheel; | |
private new void PreviewMouseWheel(object sender, MouseWheelEventArgs e) | |
{ | |
if (!e.Handled) | |
{ | |
e.Handled = true; | |
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta); | |
eventArg.RoutedEvent = UIElement.MouseWheelEvent; | |
eventArg.Source = sender; | |
Grid parent = ((Grid)sender).Parent as Grid; | |
parent.RaiseEvent(eventArg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment