4 posts, 0 answers
  1. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 24 Mar 2008 Link to this post


    in the RadDropDownMenu, I found there is a place call ContextMenu. May I know how can I make use of them?

    I already have some code done in the ContextMenu. Is there any possible way to bind it to the newly created RadDropDownMenu?

    Please advice.
  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 26 Mar 2008 Link to this post

    Hello Ching-Yen,

    It is not possible to bind your ContextMenu to RadDropDownMenu. The reason for RadDropDownMenu to have ContextMenu property is because RadDropDownMenu inherits from Control which has the same property. In addition, please note that the ContextMenu property sets instances only of type ContextMenu, so you should use RadDropDownMenu in a different approach. You should subscribe to the MouseDown event, and if the right mouse button is clicked, create and show RadDropDownMenu:
    private void btnRadDDMenu_MouseDown(object sender, MouseEventArgs e)  
        if (e.Button == MouseButtons.Right)  
            RadDropDownMenu radMenu = new RadDropDownMenu();  
            RadMenuItem radMenuItem = new RadMenuItem();  
            radMenuItem.Text = "1";  
            radMenuItem = new RadMenuItem();  
            radMenuItem.Text = "2";  
            radMenuItem = new RadMenuItem();  
            radMenuItem.Text = "3";  
            radMenu.Show(btnRadDDMenu, e.Location);  

    If you have additional questions, do not hesitate to contact me.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Tamás
    Tamás avatar
    6 posts
    Member since:
    Jul 2008

    Posted 05 Aug 2008 Link to this post


    I tried to use the code shown in the previous post. I wrote the code in the MouseDown event handler of a RadTextBox.

    My problem is that when I click in the text box with the right button, the default Windows context menu pops up with items like Cut, Paste, etc.. The RadDropDownMenu shows up only if I press the right button at the edge of the textbox.

    Is there a workaround? I just need a simple context menu for a textbox with items in it that I can click on.

  4. Martin Vasilev
    Martin Vasilev avatar
    1061 posts

    Posted 07 Aug 2008 Link to this post

    Hello Tamás,

    Thank you for writing.

    The context menu is a feature of the hosted MS TextBox and it can be stopped from showing only with a workaround. The easiest way is to assign new empty ContextMenuStrip:
    this.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.ContextMenuStrip =  
    new ContextMenuStrip(); 

    Other way to do the same you could find in following forum topic:

    I hope this helps. If you have other questions, do not hesitate to contact me again.

    Kind regards,
    Martin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top