Listview and ContextMenuStrip - doesn't work...

  • Thread starter Thread starter Ron M. Newman
  • Start date Start date
R

Ron M. Newman

Hi,

I'm attaching a ContextMenuStrip to a listview. Debugging shows the menu is
healthy with one item in it and that it's referred to by the
"listview.ContextMenuStrip". However, right clicking the list view or
elements doesn't bring up the menu. Any ideas?

Thanks,
Ron
 
I am using it without problems. Do you have any event handlers that are
interfering maybe?
 
Seems like I have to process the mouse click item, figure out which list
view element is selected and ".Show(...)" the context menu strip on the X,Y
location of the click.

for some reason I thought it's done automatically for listviews as it's done
for tree nodes. seems like I was mistaken.

thanks.
Ron
 
Seems like I have to process the mouse click item, figure out which list
view element is selected and ".Show(...)" the context menu strip on the
X,Y location of the click.

for some reason I thought it's done automatically for listviews as it's
done for tree nodes. seems like I was mistaken.

You shouldn't have to call Show on the popup menu. It should display
automatically unless you have a MouseDown handler on the listview or an
Opening handler on the popup that prevents it from showing.

If you need to determine the currently selected listview item before the
menu is shown, you can use the Opening handler of the popup. You still
shouldn't have to explicitly call Show though.
 
Back
Top