WPF: Canvas swallowing MouseDownEvent?

后端 未结 1 1913
执笔经年
执笔经年 2020-12-21 15:28

Can anybody please explain to me why theMouseDownevent is not reaching theScrollViewerin this easy example?



        
相关标签:
1条回答
  • 2020-12-21 16:01

    You will probably need to set Focusable="False" on the ScrollViewer to allow the mouse events to pass though

     <ScrollViewer Name="scrollViewer" Focusable="False" Background="Green" />
    

    Output:

    ScrollViewer_PreviewMouseDown
    Canvas_PreviewMouseDown
    Canvas_MouseDown
    ScrollViewer_MouseDown
    
    0 讨论(0)
提交回复
热议问题