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
5124
Basic setup of nested HierarchicalDataTemplates
posted

Hi IG Support,

I have attached a sample XamMenu bound to a 3-tier collection.  I am trying to use nested HierarchicalItemTemplates to display all three levels in the menu, however, only the first level is displayed.  If you run the sample, I expect "DHL" to expand to show the next level, but it does not.  Can someone take a quick look and point out my error in the markup?

Thanks!

Francis

PS - The irony is, I probably created just such a sample when I was in Dev Support. :)

XamMenuTest.zip
  • 27093
    Verified Answer
    posted

    Hello Francis,

     

    Really nice to see you. I looked into your project and you seem to have set the hierarchical ItemsSources a level lower each. Here is how it should be: 

    <ig:XamMenu x:Name="PluginSelector" 
                MenuOrientation="Vertical" ExpandOnHover="True"
                ItemsSource="{Binding Source={StaticResource PVM},Path=Carriers}">
        <ig:XamMenu.HierarchicalItemTemplate>
            <ig:HierarchicalDataTemplate ItemsSource="{Binding Path=Services}">
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
                <ig:HierarchicalDataTemplate.HierarchicalItemTemplate>
                    <ig:HierarchicalDataTemplate ItemsSource="{Binding Path=Rates}" > <!--temsSource="{Binding Path=Services}">-->
                        <DataTemplate>
                            <TextBlock Text="{Binding ServiceName}"/>
                        </DataTemplate>
                        <ig:HierarchicalDataTemplate.ItemTemplate>
                            <DataTemplate>
                                <Button Content="{Binding RateName}" 
                                        Command="{Binding Path=LoadPluginCommand, Source={StaticResource PVM}}" 
                                        CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}"
                                        BorderThickness="0" Background="White" />
                            </DataTemplate>
                        </ig:HierarchicalDataTemplate.ItemTemplate>
                    </ig:HierarchicalDataTemplate>
                </ig:HierarchicalDataTemplate.HierarchicalItemTemplate>
            </ig:HierarchicalDataTemplate>
        </ig:XamMenu.HierarchicalItemTemplate>
    </ig:XamMenu>
    

     

    Let me know, if I can help with anything else.