有没有一种方法可以点击WrapPanel的子元素并获取子元素,但不必在每个子元素中插入Click事件?我是否可以只在WrapPanel中插入Click事件?
我的代码如下:
<ScrollViewer Name="scrollViewer" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Height="500" Margin="1085,154,-89,0" HorizontalAlignment="Left" Width="267" VerticalAlignment="Top">
<WrapPanel Name="Agenda" HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" Width="265" Background="#FFEEF4FF">
<Border Name="b06x00" BorderThickness="1" Width="265" BorderBrush="Black" Visibility ="Visible">
<TextBlock TextWrapping="Wrap" Text="06:00" Width="265" Height="15" Background="White"/>
</Border>
...
this Border + TextBlock is repeated 70 times. It's an agenda by the way.
...
</WrapPanel>
</ScrollViewer>