I’m trying to use a xamDataGrid to display hierarchical data where every parent is just a sum of it’s children. For example, I want to display various types of information about cities around the world. At first my grid might first show the totals of each continent (one row per continent, with columns for Population, GDP, Annual rain fall, etc). A user should be able to expand a continent to see the totals for each Country and further expand that to see the data for each city.
What would be the best way to accomplish this? Should each parent be a list that holds lists of its children and then bind to the highest level list? Or would I be better off creating custom objects for each parent? Or is this functionality already built-in? Can the xamDataGrid automatically show sums of sums?
I am developing in WPF and using Entity Framework to hold the lowest level data (not the sums).
HI,
I modified the sample to add the columns dynamically at run time.
The XamDataGrid will automatically create fields for any public properties in the class that it is bound to.
So I only need to add two unbound fields.
Please review my sample.
Sincerely,
Matt
Developer Support Engineer
Hi,
Is it possible to dynamically generate my grid’s Fields during runtime instead of how we’re doing it in the sample solution you provided.
The reason I am trying to do this is because the rows will have a different number of children. Some may only have the parent and 1 child whereas others may have the parent with possibly 5+ children and each one of those may have its own children.
I think I can do this if the parents and children were bound to the same object but in my case the parent is bound to the sum of all it’s children and the lowest level child is bound to its own value.
Thank so much for your help.
Here a link on on how to change the expansion indicator of the XamDataGrid:
http://es.infragistics.com/community/forums/p/66014/380166.aspx
Is there any way to change the + symbol to >??
Hi Matt,
Your solution was exactly what I was trying to do.
Thank you for your help!