IsEditable setting has no effect on the TreeViewItem

2 posts, 0 answers
  1. Bill
    Bill avatar
    8 posts
    Member since:
    Dec 2012

    Posted 17 Dec 2012 Link to this post

      I set the property of IsEditable to the TreeViewItem,but it not work,the code:
    why the header=2222222,press F2 not work?

    <Telerik:RadTreeView IsLineEnabled="True" FontWeight="Normal">
                <Telerik:RadTreeViewItem Header="1111" IsExpanded="True" IsEditable="True">
                    <Telerik:RadTreeViewItem Header="22222222222" IsSelected="True" IsEditable="True" >
                    <Telerik:RadTreeViewItem Header="33333333333">
                    <Telerik:RadTreeViewItem Header="44444444444">
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1236 posts

    Posted 20 Dec 2012 Link to this post

    Hello Bill,

    Let me make a quick clarification. IsEditable is property of the RadTreeView control and if you want to enable editing the header of its RadTreeViewItems you have to do it like this:

    <telerik:RadTreeView x:Name="xTree" IsEditable="True" IsExpandOnSingleClickEnabled="True">
        <telerik:RadTreeViewItem Header="Root level item 1" IsExpanded="True" >
            <telerik:RadTreeViewItem Header="Second level item 1.1" />
            <telerik:RadTreeViewItem Header="Second level item 1.2" />
            <telerik:RadTreeViewItem Header="Second level item 1.3" />

    By using this snippet all items defined in the control will be editable. For more information you can read this article. In order to restrict which items can be edited you have to handle the PreviewEditStarted event of the RadTreeView control and based on custom logic to decide whether to edit or not. Here is sample snippet:

    private void xTree_PreviewEditStarted(object sender, Telerik.Windows.Controls.RadTreeViewItemEditedEventArgs e)
        if (e.OldValue.Equals("Root level item 1"))
            e.Handled = true;

    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top