Is it possible to group items in a ItemsControl or Listbox in Silverlight? These controls are bound to a DomainDataSource.
Or are there any 3rd party controls that do this?
UPDATE:
This is the sort of UI I am trying to create.
groupingitemscontrollistboxsilverlight
Is it possible to group items in a ItemsControl or Listbox in Silverlight? These controls are bound to a DomainDataSource.
Or are there any 3rd party controls that do this?
UPDATE:
This is the sort of UI I am trying to create.
Best Answer
You can do this by using nested
ItemsControls
bound to a PagedCollectionView.Say I have a datasource -
MyItems
- with fields:Category
,Section
andOption
. I can create aPagedCollectionView
from anIEnumerable(of MyItems)
and tell it which fields to group by.Then I bind my first
ItemsControl
to thePagedCollectionView
The
PCV
creates a nested hierachy like:where
Name
is the value in the grouped field andItems
contains the rows/objects in that grouping. I guess you could also create the PCV in xaml if you prefer.The xaml would look something like:
I hope that makes sense. I have tried to simplify things from my actual app but I could have made some mistakes in copying it over. Obviously you could use normal ItemsControls or other controls too and customize with templates etc.