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

Disable the mouse right click

3 Answers 157 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Krish
Top achievements
Rank 1
Krish asked on 30 Oct 2018, 10:55 AM
On Telerik control , when I click the items using mouse right click, it calls the same function of the left click & I'm unable to disable it. Please let me know if there is any property to disable the right click.

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Oct 2018, 02:09 PM
Hi Krish,

You can use the following approach for this: 
private void RadTreeView1_Click(object sender, EventArgs e)
{
    var args = e as MouseEventArgs;
    if (args.Button == MouseButtons.Right)
    {
        return;
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Krish
Top achievements
Rank 1
answered on 31 Oct 2018, 05:28 AM

Hi Dimitar,

Thank you so much for your time helping.I'm using nodes mouseclick event in this event. I need to disable the right mouse click event.

0
Dimitar
Telerik team
answered on 31 Oct 2018, 10:59 AM
Hello Krish,

The click event is not suitable for this case. You can use the NodeMouseDown event:
public Form1()
{
    InitializeComponent();
     
    radTreeView1.NodeMouseDown += RadTreeView1_NodeMouseDown;
}
  
private void RadTreeView1_NodeMouseDown(object sender, Telerik.WinControls.UI.RadTreeViewMouseEventArgs e)
{
    if (e.OriginalEventArgs.Button == MouseButtons.Right)
    {
        return;
    }
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Treeview
Asked by
Krish
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Krish
Top achievements
Rank 1
Share this question
or