J
J
Jaga-jaga2017-02-19 18:56:31
WPF
Jaga-jaga, 2017-02-19 18:56:31

How to properly bind a collection to a TreeView?

The crux of the matter, or rather the request.
It was necessary to develop a TreeView with CheckBoxes. When checking in a descendant, it was necessary to check from this descendant to the last ancestor.
Initially, I found the article guidesbook.blogspot.ru/2011/04/treeview-checkbox-w... , but it is not universal for any collection, and there are unnecessary movements with node IDs.
A couple of hours later, a better solution was found stackoverflow.com/questions/4042447/wpf-treeview-w... , but there was not enough autocheck, which was added.
The problem arose during binding. When I bound my collection, the autocheck didn't work because checkBoxTreeItem.Parent is null.
An attempt to bind through the HierarchicalDataTemplate does not work, or I do not know how to use it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question