We created this item to request your feedback on how you use the treeview binding with regards to the Expanded state of the nodes.
At the moment, the treeview updates the field in the collection when an item gets expanded or collapsed, and that makes it unique in the suite - the other data bound components do not alter their data source silently, and this is the general pattern we want to follow in order to have consistency across the board.
Thus, there are several approaches we are considering and we want to get your take on how you would find this most comfortable:
- Keep the current situation where the treeview updates the ExpandedField in the Data silently [we would rather change it] - the Data collection gets changed automatically. To control an expanded item, prepare the data source accordingly.
- Use the OnExpand event to get the item and its new state in order to update the collection yourself if needed. If you don't use the field for anything but to control the state of the treeview, you will not need to change anything. To control an expanded item, prepare the data source accordingly when providing it to the treeview. If you will be reusing the same data source with alterations, you may have to handle the event to sync the state between the treeview and the data.
- Use an ExpandedItems collection [we are inclined to go with this approach at the moment] - this will be a collection that you can provide to the treeview separately from its data source, like the selected items in a grid. This will let you avoid an Expanded field in the data (which we believe may not be present in an actual database anyway) and you will be able to use business logic to determine which items to add/remove to that collection, this also includes nested levels, even added through load-on-demand.