I have a wpf datagrid displaying complex data. I need to be able to group the data by 3 properties simultaneously without any nesting.
Simplified example:
Id, Name, Town Visited, Date of Visit, Shop visited
I need to be able to visualise each visit and easily see how many shops were visited in that instance. To do this, I'll need to group on id,town visited and date of visit together.
Currently I have the following:
BindingListCollectionView tableData = CollectionViewSource.GetDefaultView(*datatable from sql*) as BindingListCollectionView;
tableData.GroupDescriptions.Add(new PropertyGroupDescription("Id"));
The data comes in directly from a SQL datatable and is only grouped on the Id property.
I have done extensive research on how to do the multiple grouping and the most common answers have been to place an additional property on the data object - which would require me making a new viewmodel object for every table I take from SQL (there are many) and placing a new property on each. Or creating a converter to take the datatable object and produce a group property.
I have not found a particularly helpful guide on the second option and would really rather not have to create several new view models if I don't have to.
Is there any better way to do this grouping? Can anybody explain to me how to create a converter for this if that's the best way?