Hi
I have been trying (and failing) to dynamically create an accordion using databinding.
I have a collection called MenuGroups, which contains a string 'ModuleName' and an IList collection called MenuItems. I wish to bind the MenuGroups to the headers and the MenuItems to the content.
The closest I have managed so far uses this XAML:
<WPFToolkit:Accordion ItemsSource="{Binding MenuGroups}" HorizontalAlignment="Stretch" SelectionMode="OneOrMore">
<WPFToolkit:Accordion.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ModuleName}" />
</DataTemplate>
</WPFToolkit:Accordion.ItemTemplate>
<WPFToolkit:Accordion.ContentTemplate>
<DataTemplate>
<TextBox Text="{Binding MenuItems/MenuItemName}"/>
</DataTemplate>
</WPFToolkit:Accordion.ContentTemplate>
</WPFToolkit:Accordion>
This produces the headers correctly, but only the first menu item in each group is displayed in the content. I have tried various different connotations of the above, but as yet I have not achieved the desired result. I tried a ListView instead of a TextBlock in the content template thinking I would need that for multiple items,but that produced a blank content area.
Can anybody help?