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

Textbox and ContextMenuStrip

3 Answers 180 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Kim Johansen
Top achievements
Rank 1
Kim Johansen asked on 13 Jan 2010, 10:10 PM
Hi

If I attach a ContextMenuStrip to a RadTextBox is not showing, but if I on the same form add the same ContextMenuStrip to a normal Textbox is shows. What have I done wrong ?

Best Regards
Kim Johansen

3 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 14 Jan 2010, 01:16 PM
Hi Kim Johansen,

Thank you for the question.

RadTextBox hosts the Microsoft TextBox control for its textbox part. When you set the ContextMenuStrip property of RadTextBox, the contextmenu is shown when you right-click on the RadElements of the RadTextBox (which are available close to the border). In order to get the custom contextmenu in the textbox part as well, please set it explicitly to the hosted TextBox:
((TextBox)this.radTextBox1.TextBoxElement.TextBoxItem.HostedControl).ContextMenuStrip = this.contextMenuStrip1;

You can also use our RadContextMenu in RadTextBox. Please refer to the following help article for additional information: Assign RadContextMenu to Telerik and non-Telerik controls.

If you have additional questions, feel free to contact me.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kim Johansen
Top achievements
Rank 1
answered on 14 Jan 2010, 01:26 PM
Hi Nikolay

Thanks for your answer and that works.

But I don't understand why its not working if I set the textbox contextmenustrip property to my own contextmenustrip in design mode. Why should I do it programly ? Is it a bug in your component or do I have misunderstand something ?

Best regards
Kim Johansen



0
Nikolay
Telerik team
answered on 14 Jan 2010, 02:32 PM
Hello Kim Johansen,

Setting the RadTextBox.ContextMenuStrip property at design-time does automatically set the ContextMenuStrip property of the internal TextBox control. The automatic synchronization between RadTextBox and the internal TextBox is currently not supported.

This case is described in our help documentaton.

If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TextBox
Asked by
Kim Johansen
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Kim Johansen
Top achievements
Rank 1
Share this question
or