This project is read-only.

Dynamic Update of ContectMenu with new

May 14, 2013 at 10:31 AM
protected override System.Windows.Forms.ContextMenuStrip CreateMenu()
  var menu = new ContextMenuStrip();
  var itemMovieSearch = new ToolStripMenuItem { Text = "Movies" };
  foreach (var filePath in SelectedItemPaths)
    var directoryname = new DirectoryInfo(filePath).Name;
  itemMovieSearch.Click += (server, args) => SearchMovie();
  return menu;
Can I overide some other function get dynamic ContextMenuStrip . I want to display diffrent SubMenuItem depending on what folder i clicking on. This sample just works on first folder i rightklick. Stays the same on all folders click on after that.

Like 7z gives option that zip the file depending on what folder you are right clicking on.

May 19, 2013 at 4:45 PM

I think that at the moment, based on how the context menus are built, this is not possible to do by changing the context menu items - the items are built when needed (i.e. on the first right click of an object that is targetted by the extension) and the the menu is re-used.

However, I think that the items created can be customised at a later point by making them owner draw items. In this case, the extension takes the responsibility to drawing the item too. This would allow you to draw different text etc based on what is selected.

They interfaces that would have to be implemented are:

IContextMenu2 -
IContextMenu3 -

I'll attempt to get them implemented in the next version of the library.
May 19, 2013 at 4:46 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 31, 2013 at 9:34 AM