Suppress/Disable Cut/Copy/Paste Context Menu

4 posts, 1 answers
  1. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 20 Oct 2010 Link to this post

    We are having an issue with displaying only our custom context menu (do not want to show cut/copy/paste context menu) when the DropDownStyle is DropDown.  When the DropDownStyle is DropDownList then the context menu works as expected. 

    On a right-click (or Apps key press: Keys.Apps) the cut/copy/paste context menu is shown for the editor textbox.  We were able to work around not showing the context menu for the mouse right-click action by absorbing the MouseDown event of the TextBox (

    radDropDownList.DropDownListElement.TextBox.MouseDown += radDropDownListTextBox_MouseDown

     

    ) and then displaying our custom context menu.  We attempted to do a similar workaround by subscribing to the KeyDown event of the textbox editor component of the RadDropDownList, but we are unable to suppress the context menu.

    Is there a way (or workaround) for suppressing the cut/copy/paste context menu that is shown for the RadDropDownList textbox editor component (especially for the Apps key press)? 

    Thank you for any help and information you can provide.
    Jeremy

  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Oct 2010 Link to this post

    Hi,

    Hopefully this will work and is really straightforward. Just replace the textbox control's context menu with a dummy one. E.g

    In the Load event of your form
    Dim textEditor As HostedTextBoxBase = DirectCast(Me.RadDropDownList1.Controls(0), HostedTextBoxBase)
    textEditor.ContextMenu = New System.Windows.Forms.ContextMenu()

    Hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 21 Oct 2010 Link to this post

    Thank you for the suggestion Richard.  That seemed to do the trick!

    Jeremy
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 21 Oct 2010 Link to this post

    No problem. Glad it worked for you. 
    RIchard
Back to Top