Skip to content

Create a WPF Accordion control and bind it to data (HierarchicalDataTemplate).

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/wpf-accordion-bind-to-data-hierarchicaldatatemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF Accordion - Bind to Data (HierarchicalDataTemplate)

This example binds the WPF Accordion Control to data (MyData.Categories) and uses System.Windows.HierarchicalDataTemplate to present accordion items.

<dxa:AccordionControl x:Name="accordion" SelectionUnit="SubItem" 
        ItemsSource="{Binding MyData.Categories }" SelectedItem="{Binding SelectedItem}">
    <dxa:AccordionControl.ItemTemplate>
        <HierarchicalDataTemplate DataType="{x:Type local:Category}" ItemsSource="{Binding Items}">
            <TextBlock Text="{Binding CategoryName}"/>
            <HierarchicalDataTemplate.ItemTemplate>
                <DataTemplate DataType="{x:Type local:Item}">
                    <TextBlock Text="{Binding ItemName}"/>
                </DataTemplate>
            </HierarchicalDataTemplate.ItemTemplate>
        </HierarchicalDataTemplate>
    </dxa:AccordionControl.ItemTemplate>
</dxa:AccordionControl>

Files to Review

Related Examples

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)