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
Hello Pat,
I am glad I was able to help. Please do not hesitate to contact us if you have any questions.
Thank you , that was what was missing.
--Pat
Thank you for your post! I have been looking into your it and can suggest to change the binding for the HierarchicalDataTemplate from GroupPanelData to ChildGroupPanelList. Here is an example using the sent code snippet:
<ig:HierarchicalDataTemplate ItemsSource="{Binding ChildGroupPanelList}">
……
Please do not hesitate to let me know if you have any further questions on this matter.