Accordion binding to Header of AccordionItem

Apr 27, 2011 at 3:38 PM


I'm using the Accordion Control in a project. There I want to bind the ItemsSource of the Accordion to an enumerable of grouped data structure (IGrouping) where Key is a string and the Collection itself is data that should be shown inside an AccordionItem:

That means I'm binding the ItemsSource to an IEnumerable<IGrouping<string, IEnumerable<string>> (more or less)

So now I need the possibility to set the Header of the AccordionItem, since the AccordionItem is created when binding to the List. I tried setting the ItemTemplate to a new AccordionItem, but this is wrapped inside the AccordionItem of the Accordion

I also tried using a Converter to convert the Collection to a List of AccordionItem, but in this case I got exceptions in the Accordion itself.

How can I achieve the Binding of Header of an AccordionItem?