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

PanelBar ItemEditTemplate?

2 Answers 53 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 15 Aug 2012, 01:22 AM
Hi,
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}"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <DataTemplate x:Key="EditItemListTemplate">
            <StackPanel Orientation="Horizontal" Background="Green">
                <Image Source="{Binding Path=ThumbnailFile}" Height="20" Width="20"/>
                <TextBox Text="{Binding Name, Mode=TwoWay}"/>
            </StackPanel>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="NavListTemplate"
                                  ItemsSource="{Binding ItemLists}"
                                  ItemTemplate="{StaticResource ResourceKey=ItemListTemplate}"
                                  >
            <TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>
 
...
 
<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.ContextMenu>
                <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"/>
 
                </telerikNavigation:RadContextMenu>
            </telerikNavigation:RadContextMenu.ContextMenu>
 
        </telerik:RadPanelBar>

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 16 Aug 2012, 04:12 PM
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.

0
Will
Top achievements
Rank 1
answered on 16 Aug 2012, 04:50 PM
Thank you Tina, this definitely gets me on the right track!

Will
Tags
PanelBar
Asked by
Will
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Will
Top achievements
Rank 1
Share this question
or