我在 xaml 中有以下控件:
<Canvas Height="500" Width="500" Name="canPreview" VerticalAlignment="top" Grid.Row="1" Grid.RowSpan="3" MouseLeftButtonDown="canPreview_MouseLeftButtonDown"
MouseLeftButtonUp="canPreview_MouseLeftButtonUp" MouseLeave="canPreview_MouseLeave" MouseMove="canPreview_MouseMove"
Height="{Binding Path=ActualHeight, ElementName=imgPreview}" Width="{Binding Path=ActualWidth, ElementName=imgPreview}">
<Rectangle Name="recSelection" StrokeThickness="2" Stroke="Black" Fill="Transparent" Opacity=".5" Height="100" Width="100" />
</Canvas>
由于某种原因,Canvas 事件仅在鼠标指针位于矩形上方时触发。知道发生了什么吗?