Good afternoon!
Is it possible to implement such a ultratree?
-[]SomeText1 SomeProperty1
[]SomeText2 SomeProperty2
-[]SomeText3 SomeProperty3
[]SomeText4 SomeProperty4
Here '[]' means checkbox and '-' means expanded node.
I need this in an UltraTree with OutlookExpress ViewStyle.
In fact, when I use a column for checkbox, I am getting instead:
-[] SomeText1 SomeProperty1
[] SomeText2 SomeProperty2
-[] SomeText3 SomeProperty3
Thanks beforehand
Hi,
This is a little bit tricky, because the cell in the tree can only store one piece of information (the text). So you need a place to store the state of the checkbox.
The easiest things to do would be to add a separate CheckBox column to the tree and position it before the SomeText column.
If you must have the checkbox in the same cell with the SomeText, then the easiest thing to do would be to use an UltraTextEditor. You still need the unbound column to store the data, but you could hide it.
So what you would do is place an UltraTextEditor control on the form with your tree. Then use the ButtonsLeft property to add a StateEditorButton (which is a CheckBox).
You attach the UltraTextEditor to the tree by setting the EditorComponent property of the column.
To handle the retrieving and storing of the check state, you have to handle the InitializeEditorButtonCheckState and AfterEditorButtonCheckStateChanged respectively. These are events on the UltraTextEditor, but each event gives you an e.Context, which in this case will be the tree cell. From the cell, you can get to the row and from there, the other cells in the row, so you can access the hidden checkbox column.