Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Can't get hierarchical data to render correctly
posted

I am trying to create a very basic menu. I am using a data class that is simply a collection of strings (Titles) that may or may not have 1 to many subtitles that is filled at runtime. 

So I have,

GroupPanelsBusinessLogic that has an ObservableCollection<GroupPanelData>

GroupPanelData has a property, Title of type string and a property ChildPanelList of type ObservableCollection<GroupPanelData>

In my xaml, I bind to the GroupPanelsBusinessLogic as follows,

<Window.Resources>
<GroupPanels:GroupPanelsBusinessLogic x:Key="GroupPanelsBusinessLogic"/>
</Window.Resources>

...

<ig:XamMenu x:Name="xamNavigator"
                     Grid.Row="0"
                     ItemsSource="{Binding Source={StaticResource GroupPanelsBusinessLogic}, Path=GroupPanelList}">
    <ig:XamMenu.HierarchicalItemTemplate>
        <ig:HierarchicalDataTemplate ItemsSource="{Binding GroupPanelData}">
        <!-- Data template displays top level data -->
        <DataTemplate>
            <TextBlock Text="{Binding Path=Title}"/>
       </DataTemplate>

<!-- Item template displays child level data -->
<ig:HierarchicalDataTemplate.ItemTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding Path=Title}" />
    </DataTemplate>
</ig:HierarchicalDataTemplate.ItemTemplate>
</ig:HierarchicalDataTemplate>
</ig:XamMenu.HierarchicalItemTemplate>

</ig:XamMenu>

...

But I only get the root level menu items. I don't know what/how to bind the child items so that they display? I've tried using ChildPanelList.Title, ChildPanelList/Title, etc. but nothing seems to get them to display correctly.

I've attached a sample app demonstrating the problem.

Thanks,

Pat

xamMenuFun.zip