Insert RadTextBox in RadContextMenu

5 posts, 2 answers
  1. Mujtaba Ali
    Mujtaba Ali avatar
    6 posts
    Member since:
    Nov 2010

    Posted 17 Jun 2013 Link to this post

    Hi

    I wanted to add Text box as RadContextMenu item like we do with MS ContextMenuStrip. But I don't see any option for such.

    Can you please help me about this?

    Regards,

    Mujtaba Ali Panjwani
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 18 Jun 2013 Link to this post

    Hi, Mujtaba Ali

    Thank you for writing.

    You can achieve this by hosting a RadTextBox control in a RadMenuHostItem, as shown below:
    radContextMenu1.Items.Add(new RadMenuHostItem( new RadTextBox()));

    Do not hesitate to contact us if you have other questions.

    Regards,
    Mitko
    Telerik
    RadChart for WinForms is obsolete. Now what?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mujtaba Ali
    Mujtaba Ali avatar
    6 posts
    Member since:
    Nov 2010

    Posted 18 Jun 2013 Link to this post

    Hi

    Thanks for the reply.

    The provided code inserted the text box but the UI is not looking good because the textbox starts from the far left to the far right instead of keeping the icon margins. Would I have to set the margins for RadMenuHostItem?

    Regards,

    Mujtaba Ali Panjwani
  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 21 Jun 2013 Link to this post

    Hello Mujitaba,

    Thanks for the reply.
     

    Yes you have to set the Margin property of the RadMenuHostItem, you can do it like this:
    RadMenuHostItem MyContextMenuTextBox = new RadMenuHostItem(new RadTextBox());
    MyContextMenuTextBox.Margin = new Padding(20, 0, 10, 0);
                 
    radContextMenu1.Items.Add(MyContextMenuTextBox);

    I hope this helps.

    Regards,
    Mitko
    Telerik
    RadChart for WinForms is obsolete. Now what?
  6. Mujtaba Ali
    Mujtaba Ali avatar
    6 posts
    Member since:
    Nov 2010

    Posted 21 Jun 2013 Link to this post

    Hi

    Alright, thanks.

    Regards,

    Mujtaba Ali Panjwani
Back to Top
UI for WinForms is Visual Studio 2017 Ready