I have a silverlight datagrid which is bound to a PagedCollectionView displaying a collection of RowViewModels.
Each RowVM has a collection of CellViewModels, and the datagrid columns are templatecolumns and are generated dynamically with their content bound to Cell[0].Content, Cell[1].Content, etc. This is because the rowviewmodels are returned from a service, and can contain any number of columns and different types of content.
This works just fine, but I've run into problems when enabling sorting of columns in the datagrid. It seems the SortMemberPath property on DataGridColumns (which in the end becomes a SortDescription.PropertyName) won't work with an expression containing an index, like "Cells[1].Content".
Does anyone know a way around this?