-
[WPF] TreeViewC#/WPF 2023. 11. 21. 10:57
.xaml
<TreeView x:Name="referenceTreeView" BorderBrush="Transparent" BorderThickness="0" ItemsSource="{Binding AppManager.ReferenceNodes}"> <TreeView.Resources> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="True"/> </Style> </TreeView.Resources> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding ReferenceChildNodes}"> <TextBlock Text="{Binding ReferenceName}"/> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView>
AppManager 객체의 ReferenceNodes 프로퍼티 소스에서
ReferenceChildNodes 를 Item으로 갖는
ReferenceNode 의 ReferenceName을 Text로 바인딩.
728x90'C# > WPF' 카테고리의 다른 글
[WPF] ListBox SelectItem Don't Focus (0) 2023.12.07 [WPF] Singleton Class (0) 2023.11.28 [WPF] ObservableCollection<> Binding (0) 2023.11.02 [WPF] Pre-build event/post-build event (0) 2023.10.17 [WPF] MEF (1) 2023.10.11 댓글