PopMenu pops up anywhere the user right clicks on the form. VS2019 C#.

Olaf Berg 21 Reputation points
2021-10-27T17:27:12.197+00:00

Hi,
I have this PopMenu control(Winform) which works as expected. The problem is that it pops up on whatever place on the form the user right clicks, but the ObjectListview CellRightClick event isn't fired in such a situation. And it shouldn't.

How do I get the menu to appear only when right clicking occurs on the listview control?

The listview's property named ConTextMenuStrip is set to the name of the ContekxtMenuStrip control, which is named
PopUpMenu.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,179 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 47,471 Reputation points
    2021-10-27T17:39:17.247+00:00

    To have a context menu appear only for a single control then set the control's ContextMenu property. If you set the form's ContextMenu property then it applies to the entire form. It sounds like you might have associated it with the form as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful