Popping Up Context Menu
C#
2
Posts
2
Posters
0
Views
1
Watching
-
hi, I am just wondering how can i make Context Menu pop-up.. only if an item is selected in a ListView Control.... any help will be greatly appreciated... thanx
this should work: private void listView1_MouseUp(object sender, MouseEventArgs e) { if (e.Button==MouseButtons.Right) { if (listView1.GetItemAt(e.X,e.Y)!=null) contextMenu1.Show(listView1,new Point(e.X,e.Y)); } } If ur gonna use this feature many times in your code, it may be better to create ur own control inheriting from ListView and override the OnMouseUp method with this same code. P.D: Dont set ur ListView's ContextMenu property anywhere in ur code or via designer. Keep it Null.