Problems with inline editing

6 posts, 0 answers
  1. sonal
    sonal avatar
    15 posts
    Member since:
    Jul 2008

    Posted 14 Dec 2008 Link to this post

    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
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 15 Dec 2008 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. sonal
    sonal avatar
    15 posts
    Member since:
    Jul 2008

    Posted 15 Dec 2008 Link to this post

    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
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 17 Dec 2008 Link to this post

    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.
  6. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 18 Oct in reply to Miroslav Link to this post

    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?

  7. Milena
    Admin
    Milena avatar
    204 posts

    Posted 21 Oct Link to this post

    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!
Back to Top
UI for WPF is Visual Studio 2017 Ready