This is a migrated thread and some comments may be shown as answers.

Problem with PanelBar templates

1 Answer 40 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Tony Hawk
Top achievements
Rank 1
Tony Hawk asked on 19 Mar 2010, 11:02 PM
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

1 Answer, 1 is accepted

Sort by
0
Tony Hawk
Top achievements
Rank 1
answered on 20 Mar 2010, 01:35 PM
Alright, I've managed to solve the issue. Everything's good.
Tags
PanelBar
Asked by
Tony Hawk
Top achievements
Rank 1
Answers by
Tony Hawk
Top achievements
Rank 1
Share this question
or