Hello. Firstly thanks a bunch for this control its preety amazing. I'm having
a little trouble understanding how to use the tree list view. So far i have
successfully managed to create root nodes using the treelistview.roots method,
now i'd like to add sub items to each root node. Now i've installed a
childrengetter delegate, my issue is that the model that will be used to
populate each child node is vastly different from the model used for the root
nodes. Each root node is simply a 1 dimensional array list. the subnodes have
different models, some being between 5 to 12 dimensional models(all being
generated from various datatable). So far i keep getting an error 'cannot cast
NodexModel as Rootmodel' How can i use the treelistview control to build a
tree using a number of very different models? Sample code(even psudo code) is
much appreciated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You could make all your model classes implement the same interface, for
example, IChildrenProvider interface, and then simply call that within your
ChildrenGetter delegate. That way, each model could decide how to provide
children.
public interface IChildrenProvider
{
IEnumerable GetChildren();
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. Firstly thanks a bunch for this control its preety amazing. I'm having
a little trouble understanding how to use the tree list view. So far i have
successfully managed to create root nodes using the treelistview.roots method,
now i'd like to add sub items to each root node. Now i've installed a
childrengetter delegate, my issue is that the model that will be used to
populate each child node is vastly different from the model used for the root
nodes. Each root node is simply a 1 dimensional array list. the subnodes have
different models, some being between 5 to 12 dimensional models(all being
generated from various datatable). So far i keep getting an error 'cannot cast
NodexModel as Rootmodel' How can i use the treelistview control to build a
tree using a number of very different models? Sample code(even psudo code) is
much appreciated
You could make all your model classes implement the same interface, for
example, IChildrenProvider interface, and then simply call that within your
ChildrenGetter delegate. That way, each model could decide how to provide
children.