CollectionViewSource: TreeView not updating, ViewModel looks good

I am trying to fill TreeViewin TestExplorerControl:

Rubberduck TestExplorer WPF control

I have never had to use CollectionViewSourceit so far, so I used this tutorial to figure out how to group mine ObservableCollection<TestMethod>in XAML and use this grouping for my tree view - I applied data patterns in <UserControl.Resources>because I want flexibility to allow the user to change the way regrouping tests:

<CollectionViewSource x:Key="OutcomeGroupViewSource" Source="{Binding Model.Tests}">
  <CollectionViewSource.GroupDescriptions>
    <PropertyGroupDescription PropertyName="Result.Outcome" />
  </CollectionViewSource.GroupDescriptions>
</CollectionViewSource>

<DataTemplate x:Key="TestMethodTemplate" DataType="{x:Type local:TestMethod}">
  <StackPanel Orientation="Horizontal">
    <Image .../>
    <TextBlock .../>
  </StackPanel>
</DataTemplate>

<HierarchicalDataTemplate x:Key="OutcomeTemplate" DataType="{x:Type CollectionViewGroup}"
  ItemsSource="{Binding Items}" 
  ItemTemplate="{StaticResource TestMethodTemplate}">
  <StackPanel Orientation="Horizontal">
    <Image ../>
    <TextBlock ../>
    <TextBlock ../>
  </StackPanel>
</HierarchicalDataTemplate>

Then I have this markup for the actual one <TreeView>:

<TreeView Grid.Row="2"
  ItemsSource="{Binding Source={StaticResource OutcomeGroupViewSource}, Path=View.Groups}"
  ItemTemplate="{StaticResource OutcomeTemplate}" />

What is wrong with this markup, for TreeViewfailed to update? The ViewModel explicitly has all the data I need to display (the breakpoint that was deleted is in the current line, yellow):

debugger with a breakpoint in <code> TreeView_MouseDoubleClick </code> in the control code, behind, showing a non-null context <code> TestExplorerViewModel </code> containing 2 elements in <code> Tests </code>,> </ a > </a> </p></div></body> </html>

+4
1

. Path ItemsSource :

ItemsSource="{Binding Source={StaticResource OutcomeGroupViewSource}, Path=View.Groups}"

Path=View.Groups IntelliSense, .

Path=Groups, , , , :

Path = Groups => Cannot resolve properties

+1

All Articles