如何添加wpf
DelegateCommand
s到a中的项
TreeView
绑定到
XmlDataProvider
?我使用的是MVVM模式和复合WPF,我希望当用户双击
树视图
.
我有一个
树视图
在XAML中定义,其
DataContext
设置为
XMLDATA提供程序
:
<TreeView
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ItemsSource="{Binding XPath=/SomeTopElement/*}">
<TreeView.Resources>
<HierarchicalDataTemplate
DataType="SomeElement"
ItemsSource="{Binding XPath=child::*}">
<TextBlock Text="{Binding XPath=@SomeAttribute}" />
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
在代码的其他部分,我只是绑定到
委托代理
在视图模型中:
<MenuItem Command="{Binding NewCommand}" Header="_New" />
上面怎么办
树视图
?