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

Treeview Node Editing

5 Answers 63 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mal
Top achievements
Rank 1
mal asked on 27 Apr 2011, 08:21 PM
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.

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 02 May 2011, 09:11 AM
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
0
mal
Top achievements
Rank 1
answered on 09 May 2011, 07:59 PM
Thanks, I was able to implement it using BeginEdit method. Is there a way to completely disable the renaming using F2 key.
0
Petar Mladenov
Telerik team
answered on 10 May 2011, 01:23 PM
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
0
mal
Top achievements
Rank 1
answered on 10 May 2011, 11:02 PM
I tried it but no luck.I also set the the UIElement focus but either way didnt work
0
Tina Stancheva
Telerik team
answered on 13 May 2011, 05:15 PM
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
Tags
TreeView
Asked by
mal
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
mal
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or