2
我有一个数据源:WPF:绑定的TreeView
private List<PlayData> _treeData = new List<PlayData>();
private void Test()
{
_treeData.Add(new PlayData()
{
BoolList = new List<bool>() { true, false, true },
Name = "A"
});
_treeData.Add(new PlayData()
{
BoolList = new List<bool>() { true, false, true },
Name = "B"
});
DataContext = this;
}
如何绑定这XAML,这样的名字是父母和布尔的名单是孩子。我尝试了这一点unsuccesfully:
<TreeView x:Name="treeView" Height="200" ItemsSource="{Binding Path=TreeData}" >
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=BoolList, Mode=TwoWay}" >
<TextBlock FontWeight="Bold" Text="{Binding Path=Name, Mode=TwoWay}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
你是什么意思“不成功”? – 2010-12-08 12:05:55