How to group consecutive similar items of a collection?

Posted by CannibalSmith on Stack Overflow See other posts from Stack Overflow or by CannibalSmith
Published on 2009-09-25T15:40:35Z Indexed on 2010/03/27 4:53 UTC
Read the original article Hit count: 275

Consider the following collection.

  • True
  • False
  • False
  • False
  • True
  • True
  • False
  • False

I want to display it in a structured way, say, in a TreeView. I want to be able to draw borders around entire groups and such.

  • True Group
    • True
  • False Group
    • False
    • False
    • False
  • True Group
    • True
    • True
  • False Group
    • False
    • False

How do I accomplish this with as little procedural code as possible?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about datatemplate