Nested PanelBar

2 posts, 0 answers
  1. Jessica
    Jessica avatar
    12 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    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>


  2. Jessica
    Jessica avatar
    12 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    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>


  3. DevCraft banner
Back to Top