Home Forums WinForms controls Xceed Grid for WinForms How to detect (right) click in column header

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13638 |

    Hi everyone,

    Please excuse if this has been covered before, but I looked through the forums and couldn’t see anything.

    I am trying to offer the users of my app the ability to right click on any of the column headers to show a ‘customize columns’ context menu.
    My problem is I can’t get a click event to work for the headers.

    ColumnManagerRow1.Click doesn’t seem to be it.
    Anyone have an idea of where I should be looking?

    I already have a different context menu setup for when a user right clicks an entry in the actual grid (one of the cells).

    Thanks in advance,

    Richard.

    Imported from legacy forums. Posted by rjmorton (had 2986 views)

    User (Old forums)
    Member
    Post count: 23064

    1. If a row contains cells (ColumnManagerRow, DataRow, CellRow, …), you can’t catch any mouse events on the row itself: you have to catch mouse events on the individual cells.
    2. To catch a right-click event, you can’t use the Click-event: you should use the MouseDown-event and check if the right mouse button was used.

    Imported from legacy forums. Posted by Tommy (had 270 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve had success casting EventArgs to MouseEventArgs in the <b>Click</b> event handler to obtain the status of the mouse button. For example:

    if (((MouseEventArgs)e.)Button == MouseButton.Right)
    {
    // handle right-click
    }

    Imported from legacy forums. Posted by camera (had 3388 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.