MVVM里绑定TreeView控件的SelectedItem
<TreeView x:Name="treeView"> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectedItemChanged"> <i:InvokeCommandAction Command="{Binding SetSelectedItemCommand}" CommandParameter="{Binding SelectedItem, ElementName=treeView}"/> </i:EventTrigger> </i:Interaction.Triggers> </TreeView>
来源:http://stackoverflow.com/questions/9143107/get-selected-treeviewitem-using-mvvm