Treeview Node Editing

6 posts, 0 answers
  1. mal
    mal avatar
    6 posts
    Member since:
    Dec 2010

    Posted 27 Apr 2011 Link to this post

    Hi,

    Is there a way to bring up the editTemplate to edit a node in the treeview control by right clicking and selecting rename option instead of hitting F2 key. Do you have a sample project that does this?

    Thanks.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3055 posts

    Posted 02 May 2011 Link to this post

    Hello mal,

    Yes, you can use a ContextMenu and the RadTreeViewItem`s BeginEdit() method or the IsInEditMode boolean property. You can check out the attached project and ask if you need further assistance.

    Regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. mal
    mal avatar
    6 posts
    Member since:
    Dec 2010

    Posted 09 May 2011 Link to this post

    Thanks, I was able to implement it using BeginEdit method. Is there a way to completely disable the renaming using F2 key.
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3055 posts

    Posted 10 May 2011 Link to this post

    Hello mal,

    You can try to use the KeyDown event of the RadTreeView and set e.Handled == true if the pressed key is F2. Let us know if this helps you.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. mal
    mal avatar
    6 posts
    Member since:
    Dec 2010

    Posted 10 May 2011 Link to this post

    I tried it but no luck.I also set the the UIElement focus but either way didnt work
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3299 posts

    Posted 13 May 2011 Link to this post

    Hello mal,

    You can handle the RadTreeView.PreviewEditStarted() event in case the editing is not initiated by the ContextMenu item. You can define a bool property - isEditAllowed and to only set it to true in the EditItem() method. Then you will need to set it back to false as soon as the item is edited. I modified the sample project to illustrate this approach.

    Kind regards,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top