title: Grouping data in WPF treeview
body: <p>I want to create a WPF <code>TreeView</code> with two grouping options (radio buttons). So the data will be grouped in two different ways in a 2-level hierarchy, the lowest level being the actual data items, and the groups being just a way to represent the data for easier understanding.</p>
  
  <p>They would also be able to select items by group (checkboxes) but I got that part already figured out, e.g. if I want to represent database objects and want to have them grouped either by schema or by object type (table, view, function, etc.).</p>
  
  <p>I just don't know how I should start on the two grouping modes. Should I entirely restructure my <code>ObservableCollection</code> whenever the grouping mode changes or is there a more straightforward way?</p>
  
  <p>Also, what if my <code>DataTemplate</code> for the 2nd level would be slightly different depending on the grouping mode, for example when grouped by object type you need to display the schema on level 2?</p>
  
  <p>Can anyone give me some tips on how to start and which techniques to use?</p>