Rad Application Menu right-click

3 posts, 1 answers
  1. Vladimir Abramchuk
    Vladimir Abramchuk avatar
    3 posts
    Member since:
    Nov 2009

    Posted 22 Jul 2010 Link to this post

    Hi,

    I have a requirement to make RadApplicationMenu to open only by mouse right-click. How can I prevent mouse left button click and 'Enter' key pressing?

    Thank you in advance. 

  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 26 Jul 2010 Link to this post

    Hi Vladimir Abramchuk,

    Thank you for contacting us.

    In regards to your question, the correct approach is to override the OnMouseDown (respectively OnKeyDown) method and put your logic there. Please consider the following code snippet:
    public class MyApplicationMenu : RadApplicationMenu
    {
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                return;
            }
            base.OnMouseDown(e);
        }
     
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadApplicationMenu).FullName;
            }
        }
    }

    You can override the OnKeyDown method for the cases concerning keyboard navigation.

    Please note that you need to override the ThemeClassName in the custom application menu implementation as well. For additional information, please refer to this article.

    I hope you find this information helpful. Should you need additional assistance, do not hesitate to contact us.
     
    All the best,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Vladimir Abramchuk
    Vladimir Abramchuk avatar
    3 posts
    Member since:
    Nov 2009

    Posted 26 Jul 2010 Link to this post

    Thank you very much, it helped.
Back to Top