此方法有效的按钮事件将 TreeView 元素传递给 ViewModel,但未传递短语法事件,问题出在哪里?谢谢。
<Button Content="Search in TreeView" Height="34" Width="100">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="SearchTreeView">
<cal:Parameter Value="{Binding ElementName=TreeView}" />
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<TreeView x:Name="TreeView" ItemsSource="{Binding TreeViewSource}"/>
短句法事件
<Button x:Name="SearchTreeView" Content="Search in TreeView" cal:Message.Attach="[Event Click] = [Action SearchTreeView($source.TreeView)]" />
<TreeView x:Name="TreeView" ItemsSource="{Binding TreeViewSource}"/>