title: CollectionViewSource Use Question
body: <p>I am trying to do a basic use of CollectionViewSource and I must be missing something because it is just not working.  Here is my XAML:</p>
  
  <pre><code>&lt;Window.Resources&gt;
    &lt;CollectionViewSource Source="{Binding loc:MainVM.Instance.MapItems}" x:Key="MapCV"&gt;
       &lt;CollectionViewSource.GroupDescriptions&gt;
          &lt;PropertyGroupDescription PropertyName="SourceProject" /&gt;
       &lt;/CollectionViewSource.GroupDescriptions&gt;
    &lt;/CollectionViewSource&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;ListBox ItemsSource="{StaticResource MapCV}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled"&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid HorizontalAlignment="Stretch"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="2*"/&gt;
                      &lt;ColumnDefinition Width="2*"/&gt;
                      &lt;ColumnDefinition Width="50"/&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;TextBlock Grid.Column="0" Text="{Binding SourceType, Converter={StaticResource WorkItemTypeToStringConverter}}"/&gt;
                  &lt;ComboBox Grid.Column="1" SelectedItem="{Binding DestType}" ItemsSource="{Binding WorkItemTypesForCurrentDestProject, Source={x:Static loc:MainMediator.Instance}, diagnostics:PresentationTraceSources.TraceLevel=High}" DisplayMemberPath="Name" /&gt;
                  &lt;Button Grid.Column="2" Content="{Binding PercentMapped}"/&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;                                        
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>This compiles fine, but when I run the app I get this error:</p>
  
  <pre>
  Cannot convert the value in attribute 'ItemsSource' to object of type 
  'System.Collections.IEnumerable'. 'System.Windows.Data.CollectionViewSource' 
  is not a valid value for property 'ItemsSource'.  Error at object 
  'System.Windows.Controls.ListBox' in markup file 'WIAssistant;component/main.xaml
  </pre>
  
  <p>This is the collection I am attaching to:</p>
  
  <pre><code>// The mappings used to copy the values of the fields of one WorkItem to another.
  public ObservableCollection&lt;WorkItemTypeMapping&gt; WorkItemTypeMappings
  {
      get { return (ObservableCollection&lt;WorkItemTypeMapping&gt;)
            GetValue(WorkItemTypeMappingsProperty); }
      set { SetValue(WorkItemTypeMappingsProperty, value); }
  }
  public static readonly DependencyProperty WorkItemTypeMappingsProperty = 
      DependencyProperty.Register("WorkItemTypeMappings", 
      typeof(ObservableCollection&lt;WorkItemTypeMapping&gt;), typeof(MainMediator), 
      new UIPropertyMetadata(null));
  </code></pre>
  
  <p>I just want to do simple grouping on object <code>Project SourceProject</code>.  I would rather not have to break out a tree view for this.</p>