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

Insert RadTextBox in RadContextMenu

4 Answers 124 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Mujtaba Ali
Top achievements
Rank 1
Mujtaba Ali asked on 18 Jun 2013, 01:57 AM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 18 Jun 2013, 03:23 PM
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?
0
Mujtaba Ali
Top achievements
Rank 1
answered on 18 Jun 2013, 04:01 PM
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
0
Accepted
Dimitar
Telerik team
answered on 21 Jun 2013, 01:15 PM
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?
0
Mujtaba Ali
Top achievements
Rank 1
answered on 21 Jun 2013, 07:02 PM
Hi

Alright, thanks.

Regards,

Mujtaba Ali Panjwani
Tags
TextBox
Asked by
Mujtaba Ali
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Mujtaba Ali
Top achievements
Rank 1
Share this question
or