I have a RadTreeView with some items (see the picture).
The tree is set up to TriState with Checkboxes.
When I programatically set the CheckState property of a leaf node to ToggleState.On, it does not automatically set its parents' CheckState to either Indeterminate or On (depending on whether all the children are checked), for some of the nodes. If you take a look at the attached picture, the selected nodes were XW16351, XW2 and XW3. However, only the XW3 node's parent was checked accordingly.
If I now manually click the node (XW2 for example) with the mouse, the item gets unchecked. When I click it again to check it, all its ancestors get appropriate state (Indeterminate in my case), which is how it should work. But it does not work if the CheckState was made programatically. (I do not change the state at any other place in code and there are no bindings on that property).
Is this a bug or a feature? :) Shouldn't automatic checking of ancestors in TriState-mode work even if the node was checked programatically, and not by the mouse click?
Is there any simple workaround?
EDIT
Even more interesting scenario:
- I programmatically set the node's CheckState property to ToggleState.On. (this will check only the node, not its ancestors)
- I mouse-click the node to uncheck it. (which works as intended)
- I mouse-click the node again to check it. (now the node is checked and ancestor nodes indeed get to Indeterminate state)
- I mouse-click the node again to uncheck it. (the node and its ancestors get unchecked)
- I programmatically set the node's CheckState proerty to ToggleState.On. (unlike the first step, this works as it's supposed to - the node gets checked and its ancestors get to Indeterminate state).
How is this possible? Why does the programamtically setting the CheckState doesn't work the first time, but works correctly after some mouse-clicking intervention?
ANOTHER EDIT
One more thing I managed to deduce from my testing is that if I have previously expanded (manually) the nodes that I wish to check, so the nodes were already shown - then programmatically setting the CheckState works as intended. Which should explain why things work as described in my previous edit. Virtualization is turned off for this tree.
Why do the elements of the tree need to be shown before such behavior starts working?
The tree is set up to TriState with Checkboxes.
When I programatically set the CheckState property of a leaf node to ToggleState.On, it does not automatically set its parents' CheckState to either Indeterminate or On (depending on whether all the children are checked), for some of the nodes. If you take a look at the attached picture, the selected nodes were XW16351, XW2 and XW3. However, only the XW3 node's parent was checked accordingly.
If I now manually click the node (XW2 for example) with the mouse, the item gets unchecked. When I click it again to check it, all its ancestors get appropriate state (Indeterminate in my case), which is how it should work. But it does not work if the CheckState was made programatically. (I do not change the state at any other place in code and there are no bindings on that property).
Is this a bug or a feature? :) Shouldn't automatic checking of ancestors in TriState-mode work even if the node was checked programatically, and not by the mouse click?
Is there any simple workaround?
EDIT
Even more interesting scenario:
- I programmatically set the node's CheckState property to ToggleState.On. (this will check only the node, not its ancestors)
- I mouse-click the node to uncheck it. (which works as intended)
- I mouse-click the node again to check it. (now the node is checked and ancestor nodes indeed get to Indeterminate state)
- I mouse-click the node again to uncheck it. (the node and its ancestors get unchecked)
- I programmatically set the node's CheckState proerty to ToggleState.On. (unlike the first step, this works as it's supposed to - the node gets checked and its ancestors get to Indeterminate state).
How is this possible? Why does the programamtically setting the CheckState doesn't work the first time, but works correctly after some mouse-clicking intervention?
ANOTHER EDIT
One more thing I managed to deduce from my testing is that if I have previously expanded (manually) the nodes that I wish to check, so the nodes were already shown - then programmatically setting the CheckState works as intended. Which should explain why things work as described in my previous edit. Virtualization is turned off for this tree.
Why do the elements of the tree need to be shown before such behavior starts working?