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

posted @ 2017-03-24 16:48  无主之城  阅读(2162)  评论(0编辑  收藏  举报