I'm trying to create a treeview in which I would have a list of items (containing info about emails) grouped according to the email subject. I want something similar to the bottom image
I first tried using ListView. I got some helpful suggestions how to do it on this forum, but none worked completely. Using GroupDescriptions I was able to group emails according to the subject but since I'm using ListView I unfortunately don't get the option to be able to toggle visibility of items inside each group.
To get this feature, I tried using TreeView with the ability to show columns. Along with defining a custom TreeView it also uses a ControlTemplate to define a special TreeViewItem (called TreeListViewItem) which shows the content of the items in columns.
The only problem now is how to create the top level items that show the title of the conversation. These items should ignore the columns and should span across all columns. To find groups of emails I used the CollectionViewSource class which successfully groups emails into groups according to Subject. The problem, however, is that instead of the subject, I get a blank line in the treeview. If I double click the blank line the items inside the group open and show correctly (but still, the subject line remains blank).
The result can be seen here:
If I understand correctly, the problem lies in the fact that the controltemplate used to show the emails is not valid for showing the item with subject name. How can this problem be resolved?
If somebody would like do download the project, you can get it here.
Thank you all in advance for any help! Kind regards, Gregor