PanelBar ItemEditTemplate?

3 posts, 1 answers
  1. Will
    Will avatar
    2 posts
    Member since:
    Aug 2012

    Posted 14 Aug 2012 Link to this post

    I have a PanelBar that is templated by a HierarchicalDataTemplate.  The PanelBar also includes a ContextMenu, and when I select "Rename" in the ContextMenu I would like the selected List Item to switch to an ItemEditTemplate.  However, the HierarchicalDataTemplate doesn't provide that option and putting an ItemEditTemplate in the PanelBar doesn't seem to do anything when I switch the item IsInEditMode = true.  What do I have to do to switch to my EditItemListTemplate?  Thank you for your help!!

    Edit: I am developing in .Net 3.5 C#, using Telerik WPF 2011.03.1219.0.

    <HierarchicalDataTemplate x:Key="ItemListTemplate"   >
                <StackPanel Orientation="Horizontal">
                    <Image Source="{Binding Path=ThumbnailFile}" Height="20" Width="20"/>
                    <TextBlock Text="{Binding Name}"/>
            <DataTemplate x:Key="EditItemListTemplate">
                <StackPanel Orientation="Horizontal" Background="Green">
                    <Image Source="{Binding Path=ThumbnailFile}" Height="20" Width="20"/>
                    <TextBox Text="{Binding Name, Mode=TwoWay}"/>
            <HierarchicalDataTemplate x:Key="NavListTemplate"
                                      ItemsSource="{Binding ItemLists}"
                                      ItemTemplate="{StaticResource ResourceKey=ItemListTemplate}"
                <TextBlock Text="{Binding Name}" />
    <telerik:RadPanelBar  ItemsSource="{Binding NavSections}"  ItemTemplate="{StaticResource ResourceKey=NavListTemplate}"
                                  ExpandMode="Multiple" HorizontalAlignment="Stretch"   VerticalAlignment="Top"
                                  SelectedItem="{Binding Path=SelectedItemList, Mode=TwoWay}"  Margin="1"
                                  IsEditable="True" ItemEditTemplate="{StaticResource ResourceKey=EditItemListTemplate}">
                    <telerikNavigation:RadContextMenu x:Name="ContextMenu" Opened="ContextMenu_Opened" ItemClick="ContextMenu_ItemClick">
                        <telerikNavigation:RadMenuItem Header="Rename"/>
                        <telerikNavigation:RadMenuItem Header="Delete"/>
                        <telerikNavigation:RadMenuItem Header="Select" FontWeight="Bold"/>

  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 16 Aug 2012 Link to this post

    Hello Will,

    Unfortunately the RadPanelBar control doesn't support editing out-of-the-box. The Edit-related properties you're seeing are inherited from the RadTreeView/RadTreeViewItem class implementations. This is due to the fact that the RadPanelBar class derives from the RadTreeView class and the RadPanelBarItem derives from the RadTreeViewItem class.

    We are currently working on hiding the RadTreeView(Item) properties(featured) that aren't implemented in the RadPanelBar so that we can avoid such confusions and I'd like to apologize for the inconvenience that this might be causing in the meantime.

    However, you can create a custom logic for editing of the PanelBarItem.Headers. I attached a basic solution demonstrating one possible approach that you can use - I hope it will get you started. Please let me know if I can further assist you. 

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Will
    Will avatar
    2 posts
    Member since:
    Aug 2012

    Posted 16 Aug 2012 Link to this post

    Thank you Tina, this definitely gets me on the right track!

Back to Top