我有一个从 Panel 继承的控件。此控件基于绑定到自定义控件的集合创建按钮控件。如何处理来自孩子的 button.click 事件?这是我的 XAML。该命令不会被执行。
<ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<control:TreeContainer HorizontalAlignment="Center"
Width="Auto" Height="Auto" Margin="8,8,8,8" VerticalBuffer="20"
RootNode="{Binding Path=RootNode}"
ChildrenNodes="{Binding Path=ChildrenNodes}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Button.Click">
<cmd:EventToCommand Command="{Binding Path=TreeContainerClickCommand, Mode=OneWay}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</control:TreeContainer>
</ScrollViewer>