0
我使用的是从实体框架创建一个类(在数据库分类表)如何使用树视图创建分层数据模板?
而且只包含三个字段:
- 类别ID
- 类别名称
- ParentCategory
而且实体框架为我创建了两个导航:子类别和父类
当我在树形视图中加载集合时,它向我展示了一切,它应该只显示顶层。
我想我应该创建一个分层的数据模板,但我真的不知道如何创建它。
编辑:同类者这些情况:Entity Framework - Binding WPF Tree view control
我的控制XAML包含:
<TreeView x:Name="objectiveTree" ItemsSource="{Binding Objectives}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Subcategories}">
<TextBlock Text="{Binding Path=CategoryName}"
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
我不小心整个标题 –
对不起H.B.我没有得到你 – Darf
它是[一个meme](http://knowyourmeme.com/memes/i-accidentally),但没关系。 –