1

I have a ListView which is starting to have too many items to have on one window. I would have a ComboBox to choose a subset to display, but all need to be available. I want to be able to collapse and expand logical portions of items, under parents. The number of groupings will be dynamic.

I need a ListView not a TreeView as the ListView defines a custom ListBox. To achieve this I followed this guide: http://blogs.msdn.com/b/permanenttan/archive/2009/01/19/wpf-listview-with-check-boxes-and-no-clipping.aspx

To summarise, it is had two columns, the first contains a CheckBox, and the second contains a corresponding TextBlock. This is so I can select a row without checking the box.

<ListView>
  <ListView.View>
     <GridView>
       column definintions....

It is the <ListView.View> which isn't available in TreeView which is why I believe I must stick with ListView.

Attempting to enclose the listview in a treeview didn't go well, it would result in me having to define separate listviews and therefore the whole column definition for each . As is my understanding. Avoiding a template too would be ideal but I would settle for this.

Ideally the ObservableCollection which populates the ListView can remain unchanged, I'd prefer not having a List of these.

tjheslin1
  • 1,378
  • 6
  • 19
  • 36
  • Have you considered Expandars? They collapse and expand. – paparazzo Dec 17 '13 at 17:40
  • @Blam Cheers! Relatively new to WPF. I'll post an answer if I achieve this. – tjheslin1 Dec 17 '13 at 19:02
  • Something like this? http://www.codeproject.com/Articles/30721/WPF-TreeListView-Control – Richard Deeming Dec 17 '13 at 19:33
  • http://stackoverflow.com/questions/20576934/listview-jumps-or-does-not-shrink – paparazzo Dec 17 '13 at 21:26
  • I've been looking into this more. http://www.wpf-tutorial.com/listview-control/listview-grouping/ has been very helpful and has showed my `ListView.GroupStyle`. However I'm still stuck when it comes to splitting the collection into each group. I added an extra Property to the collection which contains an enum, I would like the collection to be split into groups based on the enum values. – tjheslin1 Dec 18 '13 at 10:05
  • My group style now looks like the code in the question of http://stackoverflow.com/questions/12319398/wpf-expand-specific-expander-inside-listview. I like this, except I need to replace `ItemsPresenter` with a way of splitting my collection by the enum value. – tjheslin1 Dec 18 '13 at 10:07

0 Answers0