Custom WPF Treeview

I am trying to write a custom Treeview in WPF where the children are linked by parent line by line.

It's hard to explain, but I'm mostly trying to create a custom version of the tree below so that our designer can customize it as needed:

Demand

Is there an easy way to do this? So far I have been hacked and not very far.

+3
source share
2 answers

This is an interesting problem. I think that probably you will need to create a custom control that subclasses TreeViewItemand add a couple of dependency properties that the parent class does not provide.

TreeViewItem ItemsControl, Selector, SelectedItem SelectedIndex. . SelectedItem: , IsSelected , , Items , SelectedItem . SelectedIndex .

, - , - , 1, 0 TreeViewItem, , SelectedIndex ActualHeight, , , .

, , . , , SelectedItem . ( .) , , , SelectedItem null Parent . 1, 0 , , SelectedItem .

, , IsSelected : .

, , .

+3

WPF TreeView, :

  • TreeView ViewModel
  • DataTemplates, ViewModel.

, .

Edit:

UserControl node, , UserControl.

2:

TreeView. DataTemplates .

0

Source: https://habr.com/ru/post/1782569/


All Articles