I am using a common Silverlight DataGrid to display results from a search. The "schema" of the search can vary from query to query.
To accommodate this, I am trying to dynamically populate the DataGrid. I can set explicitly set the columns, but I am having trouble setting the ItemSource. All of the MSDN examples set the ItemSource to a collection with a strong type (e.g. a Custom type with public properties matching the schema). The DataGrid then uses reflection to scour the strong type for public properties that will match the columns.
Since my search results are dynamic, I cannot create a strong type to represent what comes back. Can I not just give the DataGrid an arbitrary list of objects so long as the number of objects in each list matches the number of columns? Anyone know if this is possible?
I would like to do something similar to this:
List<List<object>> myResults = <voodoo that populates the result list>
myDataGrid.ItemsSource = myResults;