We have a class called TestData which contains a string called Header and a list of doubles called Data. We then add several of these TestData objects to an ObservableCollection<TestData> called UberData. As new data becomes available at run time, we either add items to the Data list of an existing TestData object in the UberData collection , or we add an entirely new TestData object to the collection. For example we might have an ObservableCollection<TestData> that contains TestData.Header = “Channel1” and TestData.Header=”Channel2”, etc.
We would like to databind the first column of the grid to the Data list for channel 1, inside the UberData collection, and the second column of the grid to the Data list object for channel 2 etc. In the binding we would like to bind the grids column 1 header to TestData.Header and the data for the grid column to TestData.Data.
Is this possible? We have failed to do this with the Microsoft WPF Grid. The general problem has been that we don't know how many collections will be inside the Uber collection as it is dynamic i.e. we don't know how many at design time.
The MS Grid control has this behaviour: A data row is created for each object in the collection, and a column is created for each property. The values of the cells in each data row correspond to the property value of each object.
Our data is column centric. We need a column for each object in the collection. Another way to put this is I have 3 arrays of doubles how do I get array 1 to show in column 1 and array 2 to show in column 2 etc.
Thanks
Stefan,
Thanks for your interest. I have attached a project we have been experimenting with.
We have been using collections because we wanted the grid to update when any new data was appeanded to it.
As you can see in this project we have created our own grid which shows the results we would like to see.
John
Hello John,
If you could send me an isolated sample project, with a data that has a structure like your original one and screenshots of the desired result, I will be able to think of a possible solution for you.
No this is not quite what we want. Let me start with something more simpler.
If I have 3 arrays of doubles and I want array 1 to be in column 1 and array 2 in column 2 etc how do I do it.
Thank you for your post. I have been looking into it and I can suggest you set the XamDataGrid’s ViewSettings’ Orientation to Horizontal like this:
<igDP:XamDataGrid.ViewSettings> <igDP:GridViewSettings Orientation="Horizontal"/> </igDP:XamDataGrid.ViewSettings>
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.