Disable the mouse right click

4 posts, 0 answers
  1. Krish
    Krish avatar
    16 posts
    Member since:
    Oct 2018

    Posted 30 Oct 2018 Link to this post

    On Telerik control winforms, when I click the radtreeview 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.
  2. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 30 Oct 2018 Link to this post

    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.
  3. Krish
    Krish avatar
    16 posts
    Member since:
    Oct 2018

    Posted 31 Oct 2018 in reply to Dimitar Link to this post

    Hi Dimitar,

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

  4. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 31 Oct 2018 Link to this post

    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.
Back to Top