Hi, It's possible to dynamic add columns based on list property of a source?
I'm binding the grid with List<Person>:
public class Person{ public int ID { get; set; } public List<Purchase> PurchasesHistory { get; set; }}
public class Purchase{ public string Product { get; set; }}
The result i'm trying to get, it's a grid with a first column showing person's ID, and then 'n' columns showing each 'Purchase' object contained in 'PurchasesHistory'.
'PurchasesHistory' list has the same number of items for each 'Person'.
What you think? Is it possible?
Thanks in advance...
Thank you Steve!
Indexers solves my problem!
Regards.
Hi,
Kind of...
The xamGrid supports indexers. http://help.infragistics.com/Doc/Silverlight/2011/1/CLR4.0/?page=xamGrid_Support_for_String_Indexers.html
Which basically means you can create a column with a key of: new TextColumn(){Key="Product[0]"};
The problem of course is that your data won't match up.
Meaning if person one's first product is a hat, it doesn't mean that person 2's first product will be a hat.
So if you wanted to organize it in some way, you'd be better off using a Dictionary instead of a list. Where the key would be a product category.
-SteveZ