Hello,
I have what I think is a simple question...if I set the Datasource of a tree to be a generic list of some object like Customer (string name, date createdOn)...how can I make the style be a checkbox?
I can also set the ViewStyle to standard, but then I am not quite sure how to set the NodeText property. When you set to standard, you don't have a column set to set the NodeTextColumn.
Thanks,
M.
Hi Michael.
You have two options. The first is to use Standard ViewStyle and the NodeTextColumn property will indicate which field in the data source (which property of your Customer object) is displayed by the node.
Or, you can use the default (Grid) ViewStyle, nodes will not display a checkbox outside of the node, but what you can do is add an unbound Boolean column to your ColumnSet to show checkboxes. So how you do it depends on whether you want to display multiple columns or not. If you are displaying multiple columns, then you have to put the checkboxes into a column.
Awesome Mike thank you.
Where is the NodeTextColumn property exposed when using Standard ViewStyle? I think that would be the easiest route given what we want to display for the user.
So even though you are displaying the tree in Standard ViewStyle, it still needs columns so that you can set the NodeTextColumn and also so that you can more easily access the other fields in the data source. The columns just won't be visible to the user. So the NodeTextColumn is a property on the ColumnSet and needs to be set there.
If you are binding the tree to a DataSource, then this will happen automatically and you can use the ColumnSetGenerated event of the tree to set NodeTextColumn. I attached a quick sample project here to demonstrate how to set the NodeTextColumn and also how to access the fields of the other columns from a node. 8831.MemDataTable CS.zip
Works great, as usual fantastic support this is why you guys are the best.