Hi,
I have one context menu having some item. What I need is
suppose the Item in listview is not selected then some of the context menu item should be disable. Say delete or Rename should be disable.
My code is like this :
private void lvwShortCuts_MouseDown(object sender, MouseEventArgs e) { if (lvwShortCuts.SelectedItems.Count > 0) { PropertyMenu = new ContextMenu();
PropertyMenu.MenuItems.Add("Rename", new EventHandler(popup));
PropertyMenu.MenuItems.Add("Delete", new EventHandler(popup));
this.ContextMenu = PropertyMenu; } } private void popup(object sender, EventArgs e) {
MenuItem miClicked = (MenuItem)sender;
string item = miClicked.Text;
if (item == "Rename") { if (lvwShortCuts.SelectedItems.Count > 0) { this.lvwShortCuts.SelectedItems[0].BeginEdit(); } if (item == "Delete") { } } }
How to get the context menu item disable.Thank You.....Suraj