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

Nested PanelBar

1 Answer 55 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Jessica
Top achievements
Rank 1
Jessica asked on 08 Sep 2011, 05:03 PM
Is it possible to make a nested PanelBar? I have a list of FAQs in categories. I want ot show all the categories in the Panel Bar, and when a user selects the category, they will be shown a list of Panel Bars with the questions in that category. When a question is clicked, the answer is shown. If it's possible, how do I make it nested? This is the code I have for the main panel bar:

<UserControl.Resources>

 

<DataTemplate x:Key="PanelBarItemTemplate">
<StackPanel >

 

    <TextBlock Text="{Binding Question}" Foreground="#80a34d" FontSize="12" TextWrapping="Wrap" Width="450" />

 

    <TextBlock Text="{Binding Answer}" TextWrapping="Wrap" Width="450" />

 

</StackPanel>

 

</DataTemplate>

 

 

<telerik:HierarchicalDataTemplate x:Key="PanelBarHeaderTemplate"

 

         ItemsSource="{Binding RelatedItems}"

 

         ItemTemplate="{StaticResource PanelBarItemTemplate}" >

 

    <TextBlock Text="{Binding Category}" HorizontalAlignment="Left" TextWrapping="Wrap" Width="450" />

 

</telerik:HierarchicalDataTemplate>

 

</UserControl.Resources>

 

 

<Grid x:Name="LayoutRoot" DataContext="{Binding}">

 

    <telerik:RadPanelBar x:Name="radPanelBar" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch"

 

         ItemTemplate="{StaticResource PanelBarHeaderTemplate}" Width="auto">

 

    </telerik:RadPanelBar>

 

</Grid>


1 Answer, 1 is accepted

Sort by
0
Jessica
Top achievements
Rank 1
answered on 08 Sep 2011, 05:32 PM
Nevermind! It was much simpler than I was originally trying to make it. If anyone is interested, the nested block is:

<DataTemplate x:Key="PanelBarItemTemplate">

<StackPanel >

 

    <telerik:RadPanelBar HorizontalAlignment="Left" Name="radChildPanelBar" VerticalAlignment="Top" Width="440">

 

        <telerik:RadPanelBarItem DropPosition="Inside" Header="{Binding Question}" TabNavigation="Once">

 

            <TextBlock Text="{Binding Answer}" TextWrapping="Wrap" Width="440" MaxWidth="440" />

 

        </telerik:RadPanelBarItem>

 

    </telerik:RadPanelBar>

 

</StackPanel>

 

</DataTemplate>


Tags
PanelBar
Asked by
Jessica
Top achievements
Rank 1
Answers by
Jessica
Top achievements
Rank 1
Share this question
or