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

Problems with inline editing

6 Answers 144 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
sonal
Top achievements
Rank 1
sonal asked on 15 Dec 2008, 05:40 AM
Hi,
I have few questions on inline editing:

1. There is a protected variable isInEditMode, which indicates that a RadTreeViewItem is in edit mode. Is there a public property or any other way to identify whether a RadTreeViewItem  is in edit mode?
2. Pressing F2 triggers inline editing, after editing node text, if i press enter then Edited event gets fired but if i use mouse click to lose focus from editing item, then it (Edited event) does not, why?
3. I am initiate the inline editing by calling BeginEdit() but want to disable it on F2 key press, Is there any way to achieve this?

Thanks
Sonal

6 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 15 Dec 2008, 05:20 PM
Hello Sonal,

Straight to your answers:

1. This is a private variable - we don't expose any public member that you can check for that.
2. Only the Enter key "commits" the edit. When the node looses focus the edit operation is actually canceled. That is why we raise the event only when the Enter key is pressed.
3.  No - for the moment.

Please let us know what is your scenario? Based on that we can improve the API so it can cover your needs.

Thanks in advance.


Greetings,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
sonal
Top achievements
Rank 1
answered on 16 Dec 2008, 05:08 AM
Hi,

1. This is a private variable - we don't expose any public member that you can check for that.
Sonal - I am binding the visibility of few controls with a property which will indicate whether RadTreeViewItem is in edit mode.
Currently i have a private variable myIsInEditMode, which i update when editing starts and after it is completed.
It would have been easier to keep track, if RadTreeViewItem had exposed isInEditMode as public property.

2. Only the Enter key "commits" the edit. When the node looses focus the edit operation is actually canceled. That is why we raise the event only when the Enter key is pressed.
Sonal - I display a context menu on RadTreeViewItem and when menu is clicked for Edit operation,  by calling clickedItem.BeginEdit(),
RadTreeViewItem enters in edit mode, user types into the editor and then come out using a mouse click outside the editor. User will expect that editing operation is completed and item should diaplay new name, but RadTreeViewItem 's Edited event is not fired which should get fired ideally .

3. Disabling F2
Sonal - I might need to customize and associate some other key or no key to start inline editing. For e.g. i m starting editing on context menu item click and do not require to edit on F2 click.

Thanks
Sonal
0
Miroslav
Telerik team
answered on 17 Dec 2008, 03:55 PM
Hi Sonal,

Currently, you can disable the F2 key by handling the KeyDown event. Unfortunately you cannot assign other KeyBindings at this time:

myTreeView.PreviewKeyDown += new KeyEventHandler(myTreeView_PreviewKeyDown);  
 
...  
 
void myTreeView_PreviewKeyDown(object sender, KeyEventArgs e)  
{  
    if (e.Key == Key.F2)  
    {  
        e.Handled = true;  
    }  

Yes, indeed clicking away from the item now cancel editing. Unfortunately I cannot offer a workaround and understand that your scenario is perfectly valid.

We will fix that for the next ServicePack/Release and if it is urgent, we can send you a hotfix earlier.

I hope that we will be able to resolve this quickly,

Best wishes,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 18 Oct 2016, 08:44 PM

I realize this thread is very old, however, it's still a problem. With a node being edited, clicking away stops the edit (correct), but does not commit the edit, which is the standard behavior.

Also, clicking somewhere else in the treeview, but not on an item, does *not* stop the edit. This leaves the edit box still there but not focused. Can you offer a workaround?

0
Milena
Telerik team
answered on 21 Oct 2016, 08:50 AM
Hello Jason,

You can take a look at this forum post where a similar behavior is discussed. You can see how to control the editing of treeview items on lost focus or when click on another control. You can also change the built-in behavior of editing using CommitEdit() method to submit changes if you need to.

I hope this information is helpful. 

Regards,
Milena
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Jason D
Top achievements
Rank 1
Veteran
answered on 12 Dec 2016, 09:10 PM
Correction to my post. Appears to all be working as is. I was testing with a sample WPF application which didn't have the view model correctly implemented. Still new to WPF...
Tags
TreeView
Asked by
sonal
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
sonal
Top achievements
Rank 1
Miroslav
Telerik team
Jason D
Top achievements
Rank 1
Veteran
Milena
Telerik team
Share this question
or