WPF 的ScrollViewer的MouseLeftButton事件

时间:2021-12-04 14:08:32

本人小白,为什么我在WPF 的ScrollViewer添加MouseLeftButton事件点击鼠标却一点反应都没有,在xaml添加了事件,后台也添加了方法

<ScrollViewer HorizontalAlignment="Left" Height="276" Margin="35,34,0,0" VerticalAlignment="Top" Width="472" MouseLeftButtonDown="ScrollViewer_MouseLeftButtonDown_1">
<TextBlock Height="54" TextWrapping="Wrap" Text="TextBlock" Width="171"/>
</ScrollViewer>

 

private void ScrollViewer_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("Error!");
}