Reputation: 283
I'm having problems with grouping my objects in an ObjectListView.
I've already looked for some examples on Google but nothing fit or worked for me.
For each different value in a special column I want to add a group and put all objects with the same value into this group.
I want to group by the driver of a car:
this.AenderungenFOLV.ShowGroups = true;
this.olvColumn1.GroupKeyGetter = delegate(object rowObject)
{
Fahrzeug fahrzeug = (Fahrzeug)rowObject;
return fahrzeug.Fahrer;
};
Upvotes: 2
Views: 5973
Reputation: 6122
There are several things that come to my mind
By default the grouping is performed on the primary column or the last sort column (if it has been sorted). You may have to either
olv.BuildGroups(groupColumn, sortOrder);
olv.AlwaysGroupByColumn = groupColumn;
olv.Sort(groupColumn);
to implicitly trigger groupingOne of the above should suffice.
Upvotes: 4