Question

I'm trying to use an ItemsControl -instead of an ItemsPresenter- to render the Items of a GroupItem but can't find out the right Property to bind to.

<ControlTemplate TargetType="{x:Type GroupItem}">
 <Expander Header="{Binding Name}">
  <ItemsControl 
    ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=??}"/>
   <!--<ItemsPresenter  />-->
 </Expander>
</ControlTemplate>

Whatever property I'm using does show nothing so what's the Property of a GroupItem to use as an ItemsSource?

Thanks in advance.

Était-ce utile?

La solution

Each group is represented by an instance of CollectionViewGroup which publishes Items property:

<ControlTemplate TargetType="{x:Type GroupItem}">
   <Expander Header="{Binding Name}">
      <ItemsControl ItemsSource="{Binding Items}"/>
   </Expander>
</ControlTemplate>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top