question

OlafBerg-1029 avatar image
0 Votes"
OlafBerg-1029 asked cooldadtx answered

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

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.

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

cooldadtx avatar image
0 Votes"
cooldadtx answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.