Frage

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.

War es hilfreich?

Lösung

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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top