How to replace editing control with MaskedTextBox?

7 posts, 1 answers
  1. Dragoljub
    Dragoljub avatar
    26 posts
    Member since:
    Feb 2008

    Posted 09 Jan 2009 Link to this post

    I guess the title says it all. What I would like to do is dynamically replace the editing control used to edit nodes in the tree view, and only for specific nodes. Is there a way to do this?

    The reason for doing this is to enable entering a phone number with an existing mask, and not force users to enter the mask as well. There's also a need to perform custom formatting on the value of the node when it is being displayed. For example, the stored value should be 3213214321 and displayed something like (321) 321-4321. How should I do that?
  2. Answer
    Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 12 Jan 2009 Link to this post

    Hi Dragoljub,

    Currently, RadTreeView does not support other editors (other that the text box editor),
    This is a feature that we will probably add in a future release. Unfortunately, I cannot give you specific time frame for this feature at the moment.

    Regarding the formatting, you could try the newly added functionality that allows HTML-like formatting of text. For example you could set a node's text as shown below:
    node.Text = "<html><b>Node text</b>"

    You could also try formatting the strings that are set to the Text property of a RadTreeNode using your own custom logic.

    Hope this helps.

    Best wishes,
    Jordan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dragoljub
    Dragoljub avatar
    26 posts
    Member since:
    Feb 2008

    Posted 12 Jan 2009 Link to this post

    Thanks! It helps :)

    I knew this masked text box thing was a long shot, but I had to ask.

    I can store the original value (the one that is stored in the database) inside the Tag. The displaying and saving the data is custom code anyway (it's not databound). It's just that I didn't work on that code and I wanted an opinion before I went into the code.
  5. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 15 Jan 2009 Link to this post

    Hi Dragoljub,

    I am glad to see that I could help.
    Do not hesitate to write if you have more questions, suggestions, etc.

    Greetings,
    Jordan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Dragoljub
    Dragoljub avatar
    26 posts
    Member since:
    Feb 2008

    Posted 20 Mar 2009 Link to this post

    Hi again,

    From the documentation:

    "RadGridView and RadTreeView share common editing patterns and interfaces, which means that the editors are automatically assigned based on the type of data that is available for editing. At present the RadTreeView uses only the text box editor for editing node Text properties. When an editor is invoked the EditorRequired event fires allowing the editor implementation to be replaced by a custom instance."

    So, how do I make and/or select a custom editor, what class do I inherit from etc?

    If this is not what I think it is, then give an example of what that paragraph actually means.
  7. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 24 Mar 2009 Link to this post

    Hello Dragoljub,

    Thank you for writing.

    Indeed, we have plans to use in RadTreeView the same editor framework that is used in RadGridView.
    Unfortunately this feature was postponed in favor of others with higher priority. It seems that our intentions were reflected in the documentation too early and then not all of the topics were updated to reflect the change of plans. This part of the documentation is now fixed.

    You could try creating a custom editor by inheriting from the appropriate visual element (depending on your scenario) and implementing the IValueEditor interface. However, since this is a custom scenario it will require implementation from your side and I am afraid that this task may not be very easy.

    All the best,
    Jordan
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  8. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Mar 2011 Link to this post

    Hi Dragoljub,

    Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post

    Regards,
    Stefan
    the Telerik team
Back to Top
UI for WinForms is Visual Studio 2017 Ready