问题: 这个结构导致ListBox拦截了滚轮事件
解决:
xaml
<ScrollViewer>
<ListBox Name="ListBox_Answers" PreviewMouseWheel="ListBox_Answers_PreviewMouseWheel" >
</ListBox>
</ScrollViewer>
xaml.cs
private void ListBox_Answers_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;
var parent = ((Control)sender).Parent as UIElement;
parent.RaiseEvent(eventArg);
}
}
总结:
拦截滚轮事件,new一个新事件,父控件RasizeEvent
————————————————
版权声明:本文为CSDN博主「Coco在努力」的原创文章,遵循CC 4.0 BY-SA版权协议,转载附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/duan20102480102/article/details/51097869