我现在正在使用 TreeView。如您所见CurrentMediumObjectives, 和  ChildrenObjective是相同的对象类型,称为Objective.
此类有一个名为 的属性Level,其中 inChildrenObjective设置为 1 并ChildrenObjective设置为 2。
我想DataTemplate根据Level.
    <TreeView ItemsSource="{Binding CurrentMediumObjectives}"
        Margin="0,40,0,0">     
        <TreeView.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding ChildrenObjective}">
                <TextBlock FontWeight="Bold">
                    <Run Text="Objective " />
                    <Run Text="{Binding Level}" />
                </TextBlock>
            </HierarchicalDataTemplate>
        </TreeView.ItemTemplate>
    </TreeView>
我对是否应该使用 DataTemplateSelector 或 DataTrigger 感到困惑。提前致谢。
