我尝试创建一些网格。在每个Grid上我都有一个mouse-eventlistener,当我用鼠标悬停在这个Grid上时会激活一个事件。现在我用zIndex = 1和Rowspan = 3创建一个大网格。这个网格位于前面(因为zIndex = 1)。现在我有问题用zIndex = 1来触发大网格背后的网格事件。如何触发位于大网格后面的网格事件?
简单代码示例:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="AliceBlue"/>
<Grid Grid.Row="1" Grid.RowSpan="3" Panel.ZIndex="1" Background="Aqua" Opacity="0.2" PreviewMouseMove="Grid_PreviewMouseMove_1"/>
<Grid Grid.Row="2" PreviewMouseMove="Grid_PreviewMouseMove" Background="AntiqueWhite"/>
<Grid Grid.Row="3" PreviewMouseMove="Grid_PreviewMouseMove" Background="Beige"/>
<Grid Grid.Row="4" PreviewMouseMove="Grid_PreviewMouseMove" Background="Bisque"/>
<Grid Grid.Row="5" PreviewMouseMove="Grid_PreviewMouseMove" Background="BlanchedAlmond"/>
</Grid>