Theoretically speaking you can just group your data by date (using Linq), use the sum function to fill in Value1, Value2 and Value3 columns (assuming that you have one item per one date it will sum only that one, and in that case it will work the same with Min, Max and Average functions instead of Sum) and just transpose that table and you are done.
So grouping you will get you something like this
Value1 Value2 Value3
1 6 8 79
2 9 51 45
3 56 7 57
4 78 21 25
and transpose will get you to your goal.
But, where would we be without at least one but. Right. :)
In order to do this kind of thing right, you'll have to use dynamic expressions that will adapt to your data and create dynamic type accordingly (dynamic type will have properties that correspond to date values in your
ObservableCollection
). Generally this is not a problem in full .net framework 4.0 (fastest way is to use [
dynamic linq] - download dynamic linq [
here]), but since you are using Silverlight we are talking about very restricted dynamic expression framework (i.e. dynamic linq
will not work in Silverlight).
Since you have grouped data I will skip to the fun part. And as it will be too much code to write right now, I will try to describe how I would do that.
You can forget about binding data and instead make your own grid (table) and fill it with right data manually. Create structure to hold all possible dates ordered (and distinct, I assume). Create first row as header row and fill in the date descriptions for columns of your table. Create first column as header column with descriptions Value1, Value2 and Value3. Then iterate over your collection of
MyDateObject
's objects and for each item find index of
Date
in structure that holds all dates as that will be the column index of your values in grid.
Happy coding.