This is a migrated thread and some comments may be shown as answers.
Rad Application Menu right-click
2 Answers 55 Views
This is a migrated thread and some comments may be shown as answers.
Vladimir Abramchuk
Top achievements
Rank 1
Vladimir Abramchuk asked on 22 Jul 2010, 03:26 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 26 Jul 2010, 05:29 PM
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
0
Vladimir Abramchuk
Top achievements
Rank 1
answered on 26 Jul 2010, 06:49 PM
Thank you very much, it helped.
Asked by
Vladimir Abramchuk
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Vladimir Abramchuk
Top achievements
Rank 1
Share this question
or