如何检测WPF WebView控件的鼠标滚轮



我正在尝试使用PreviousMouseWheel事件检测何时在WPFWebView控件上使用鼠标滚轮。在xaml中,我尝试将标记添加到WebView,但只有当鼠标位于WebView控件之外时,事件才会触发。我还在包含的Grid和Window本身上尝试了标记,但结果相同。

xaml:

<Grid Name="windowGrid">
<StackPanel>
<Grid x:Name="gridTest" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Controls:WebView Name="wvc" Grid.Row="0" Grid.Column="0"
Width="800" Height="600" 
Source="http://www.google.ca"
PreviewMouseWheel="my_PreviewMouseWheel"
/>
</Grid>
</StackPanel>
</Grid>

不支持。通常,冒泡路由事件用于跟踪UI元素的状态更改。但如果查看GitHub上的源,可以发现只引发了一个路由事件new RoutedEventArgs(GotFocusEvent)

最新更新