The problem:
I have a list of objects which have Date, Name, and Value Properties. Name and Date properties could be different or the same.
orange 2012-01-01 1
orange 2013-01-01 0
I’d like create a GridView with Headers (which are distinct dates) and rows
Name 2012-01-01 2013-01-01
orange 1 0
As you see objects do not have properties like ‘2012-01-01’, so simple binding will not help.
Question
How can I create a binding using column’s name?
This I’d like to do with XAML or converters, without using UserControl’s events
Essentially what you need to do (as you’ve noticed) is create a list of objects with dynamic properties (that is, properties populated at runtime). The transformation itself is a pivot on Date, with a sum (?) across value, which you can perform using a GroupBy Linq query in your converter.
Now for the tricky part. Take a look at this answer:
Data binding dynamic data
You need to implement ICustomTypeDescriptor to implement dynamic properties. Good luck.