Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
Binding a tree to a Generic List
posted

Here's what I would like to be able to do - hopefully the tree can do this for me but if not can someone give me some pointers about how I can achieve it another way?

I have a generic list of orders. They have a number of public properties, one of which is an "order type".
What I would like to see in the UltraTree is the "order types" to be simple labels on the first level of the tree, allowing the user to open the appropriate ordertype "branch" to see the individual orders for that order type.

I appreciate I could create a dataset from the generic list at runtime and put two tables in there (ordertypes and orders) with a relationship between them - but I wondered if there is some way to configure the UltraTree to essentially 'group' the orders by ordertype and create the hierarchy automatically. Perhaps I'm asking too much!

I should also point out that I intend to use the UltraTree because different ordertypes need to have different column headings so I was advised the tree was the way to go - but if there is a better way I'm all ears.

Can anyone help?

Thanks

Mark

Parents
  • 469350
    Verified Answer
    Offline posted

     Hi Mark,

        You are kinda stuck between two peices of functionality here.

        The WinGrid would make it a lot easier for you to group the data, because the WinGrid support OutlookGroupBy. So you could bind the WinGrid to a single BindingList and then group by the OrderType column.

        However, the grid can only bind to homogenous data and the column headers on the child bands must all be the same. So that won't work.  

        The WinTree can have different sets of column header and bind to different object on each node. But it doesn't support OutlookGropBy.

        So it seems to me that what you will need to do is somehow divide up your data into multiple lists.

        What I would do is - don't bind the root level of the tree. Instead just manually add the root level nodes with a node for each OrderType. Then what you can do is bind the child Nodes collection of each of these parent nodes to a BindingList that contains the items of that type.  

Reply Children