Pablo
Pablo

Reputation: 29519

How to group items in ObjectListView?

I have specific case of grouping items in ObjectListView. Usually one would choose column that is shown in the list and do GroupKeyGetter/GroupKeyToTitleConverter magic on that column. However, in my case the data I would like to group on is not supposed to be shown in ObjectListView. It exists only in Model. So far the only dirty workaround I've found is to make this data shown in ObjectListView, but set width of column 0.

Is there better way to group by data, which is not supposed to be shown in the view?

Upvotes: 0

Views: 1178

Answers (1)

peschanko
peschanko

Reputation: 363

You can hide your column:

OLVColumn column = new OLVColumn("HiddenGroupColumn", "ModelProperty");
column.IsVisible = false;
column.GroupKeyGetter = delegate(object x)
{
    return ((Model)x).ModelProperty;
};

Upvotes: 1

Related Questions