TreeView cancel node edit

4 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Aug 2010

    Posted 09 Aug 2010 Link to this post


    How can i check while treeview node is editing if one of the keys (< > ? * | " / \ ) is pressed?
    And in case that one of the keys is pressed how can i cancel edit?

    Also it seems that treeview_ValueChanging event is not raised for couple of these characters.

    Thanks,
    Vladan
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Aug 2010 Link to this post

    Hi Vladan,

    Thank you for your question. 

    Please refer to the following help article which will provide you with the needed information. 

    Let me know whether you have further questions.
     
    Kind regards,
    Stefan
    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. UI for WinForms is Visual Studio 2017 Ready
  4. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post


    Hi Stefan,

    Maybe i was not clear with my question. I have treeview, populated with nodes. When user adds new node he can edit that node.
    How can i check new text and intercept one of my characters, and if one of them is used how can i cancel edit and inform user that used character is unavailable? I tried something like this, but it didn't work:

            void FolderTree_ValueChanging(object sender, ValueChangingEventArgs e)
            {           
                char[] forbidden = {'/', '\\' , '?' , '|' , '*' , '"' , '<' , '>' , ':'};
                foreach (char newChar in forbidden)
                {
                    if (((char)e.NewValue) == newChar)
                    {
                        //HandleUnwantedChar
                        e.Cancel = true;
                    }
                }
            } 

    Do you have any idea how this simple procedure can be done?
    Any sample code would be nice.
    Also ValueChanged event is not raised when character | is used.

    Best regards,
    Vlada
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 17 Aug 2010 Link to this post

    Hi Vladan,

    Thank you for your reply. 

    We checked whether your scenario is possible, but unfortunately, it is not and there is not a workaround we can suggest. 

    However, we are planning a major refactoring of this control in order to improve its behavior and performance.

    I apologize for the introduced inconvenience. If there is anything else we can help you with, do not hesitate to contact us.
     
    All the best,
    Stefan
    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