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
580
HierarchicalDataTemplate with MenuTool
posted

I have this hierarchy of menu items and are templated as follows, but I'm unable to get the second level template (Header) get to work.

    public class MenuItem
    {
        public MenuItem()
        {
            Children = new List<MenuItem>();
        }
 
        public string Header { getset; }
 
        public ICommand Command { getset; }
 
        public List<MenuItem> Children { getset; }
    }

 

                    <igs:MenuTool Caption="New" ItemsSource="{Binding Menus}">
                        <igs:MenuTool.ItemTemplate>
                            <HierarchicalDataTemplate DataType="local:MenuItem" ItemsSource="{Binding Children}">
                                <TextBlock Text="{Binding Header}"/>
                                <HierarchicalDataTemplate.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Header}"/>
                                    </DataTemplate>
                                </HierarchicalDataTemplate.ItemTemplate>
                            </HierarchicalDataTemplate>
                        </igs:MenuTool.ItemTemplate>
                    </igs:MenuTool>

Can you help with this?