I hope someone can help me.
I'm working on displaying hierarchical data in a xamDataGrid. The data that I'm using is retrieved as a flat list. I've created a class in the same way that the LibraryBusinessLogic is layed out in the xamFeatureBrowser. The only difference is that rather than having specific properties for the classes for different levels,they hold a custom "item" object, and also the collection of any child "item". The item object then contains the various properties such as ID, Description etc...
The datagrid displays the data, but there is only one column named "Item" which then contains a long string of all the properties in the item object. I've tried field layouts like this:
<igDP:FieldLayout Key="TopLevel" > <igDP:FieldLayout.Fields> <igDP:Field Name="ItemID" /> <igDP:Field Name="ItemDescription" /> <igDP:Field Name="LastScanned" /> <igDP:Field Name="LocationDescription" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout>
But it seems whatever I do, it only displays one column.
Is there any way to get it putting the properties into their own columns, or do I need to add public properties to each class to access the "item" properties that I want from it?
I can provide more information if it's not clear what I'm doing but I didn't want to confuse the initial post too much!
Many thanks!
Rob
Hi Rob,
A great way to display hierarchical data in the XamDataGrid is by ObservableCollection. I have recently created and posted a sample of that. Here is the link and hope this helps you. If you still have any trouble feel free to give me some more information on your problem.
http://forums.infragistics.com/forums/t/20031.aspx
I've decided to go with the public properties for now as it works and isn't a great hassle.
Another quick question. In terms of displaying the data, I'd like to have the top level display a header but not the lower levels. The only way I've found to do this so far is to alter my hierarchical class structure so I have a class dedicated to top level items called "DataGridScannedItems" and then a class for any child level items "DataGridItems"
Both classes are identical in structure, properties etc... but in order to have two seperate FieldLayouts (one with LabelLocation set to Default and the other for all child levels with LabelLocation set to Hidden), as far as I can make out I have to have two distinct classes so that the first FieldLayout can have it's key set to "DataGridScannedItems", and the second FieldLayout can have it's key set to "DataGridItems", thereby differentiating the two classes.
Is it possible to do this without needing the two classes that could otherwise be one class?