Problem with PanelBar templates

2 posts, 0 answers
  1. Tony Hawk
    Tony Hawk avatar
    2 posts
    Member since:
    Mar 2010

    Posted 19 Mar 2010 Link to this post

    Hi

    I'm trying to populate PanelBar with items (textboxes for instance), and I'm having problems setting up ItemTemplates.

    My XAML looks like this:

        <UserControl.Resources> 
            <DataTemplate x:Key="ItemsTemplate"
                    <TextBlock Text="{Binding Text}" /> 
            </DataTemplate> 
     
            <Data:HierarchicalDataTemplate x:Key="SectionsTemplate" 
                    ItemTemplate="{StaticResource ItemsTemplate}" ItemsSource="{Binding MenuItems}"
                <TextBlock Text="{Binding Header}" /> 
            </Data:HierarchicalDataTemplate> 
        </UserControl.Resources> 
         
        <Grid> 
            <telerikNavigation:RadPanelBar x:Name="panelBar" ItemsSource="{Binding Sections}" 
                    ItemTemplate="{StaticResource SectionsTemplate}" /> 
    </Grid> 

    My data structures look like this:

        public class MenuItem 
        { 
            public string Name { getset; } 
            public string Text { getset; } 
            public string IconPath { getset; } 
            public string ViewName { getset; } 
        } 
     
        public class SectionItem 
        { 
            public string Header { getset; } 
            public string ImagePath { getset; } 
            public ObservableCollection<MenuItem> MenuItems { getset; } 
        } 

    Finally, I have an observable collection called
    public ObservableCollection<SectionItem> Sections { getset; } 

    The strange thing is, sections and their headers are displayed correctly, but items that should be inside them are nonexistent, I simply can't get them to display.

    Could you provide a working example of this kind of menu, because I've tried all possible combination and I simply can't get it to work. Perhaps I'm doing something wrong, but I have no idea where to being looking.

    Thank you
  2. Tony Hawk
    Tony Hawk avatar
    2 posts
    Member since:
    Mar 2010

    Posted 20 Mar 2010 Link to this post

    Alright, I've managed to solve the issue. Everything's good.
  3. DevCraft banner
Back to Top