1

Can anyone explain how to use the GroupDescription class of the .NET library to implement anything else than (a class like) the PropertyGroupDescription class?

In other words: What other kinds of grouping are possible by subclassing GroupDescription? Can you give a concrete example of how to implement the GroupNameFromItem(...) method of GroupDescription?

Arne
  • 51
  • 3
  • You could make a GroupDescription that groups XmlElements based on their attributes. (No, I am not going to write an example implementation.) – Emond May 12 '11 at 08:00
  • Ok, so this is a kind of advanced property, in so far as the attributes can be seen as properties of the XmlElements. Fair enough. But the actual grouping still seems to be straightforwardly property-based; are all uses of GroupDescription limited to such property-based grouping, or could one imagine a more sophisticated one? – Arne May 12 '11 at 08:08
  • Anything you can get your hands on for each object goes. You implement the GroupNameFromItem method for the type you want to group. Any method or property that helps you to determine the groupname is valid. – Emond May 12 '11 at 08:12
  • What problem are you trying to address? What is causing this question? – Emond May 12 '11 at 08:13
  • To make that possible you would have to pass several GroupDescriptions for different levels to the collection view. The standard collection view takes only one as far as I know. – Emond May 12 '11 at 08:50
  • All the example usages I have seen have been grouping on orthogonal properties, i.e., grouping on property A at level 1, on property B at level 2, etc. What I haven't come across is semi-structured grouping, allowing for instance different level-1 groups to have different subgroups, like this (contrived) example: A) Mammals, A.1) Humans A.1.I) Employed, A.1.II) Unemployed, A.2) Whales, A.2.I) Dangerous, A.2.II) Friendly, A.3) Others, B) Insects, etc. I wonder whether the GroupDescription class could be used for this? – Arne May 12 '11 at 08:50
  • Several GroupDescriptions can be passed to the [PagedCollectionView](http://msdn.microsoft.com/en-us/library/dd538382(v=VS.95).aspx) class, but this gives orthogonal grouping, I think. I don't see how you could achieve semi-structured grouping this way. – Arne May 12 '11 at 10:08

0 Answers0