にバインドされDelegateCommand
たアイテムにWPF を追加するにはどうすればよいですか? 私はMVVMパターンとコンポジットWPFを使用しています.ユーザーが.TreeView
XmlDataProvider
TreeView
に設定されているTreeView
XAMLで定義されています:DataContext
XmlDataProvider
<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>
コードの他の部分ではDelegateCommand
、ViewModel の にバインドするだけです。
<MenuItem Command="{Binding NewCommand}" Header="_New" />
上記でこれを行うにはどうすればよいTreeView
ですか?