Reasons of behavior you reported:
Behavior you have reported is due to the bug of MS Excel 2013 core.
Behavior is not due to the libriaries/toolkits for creating Excel add-ins as:
- I experience the same problem with VSTO 2010 while you report your issue for ExcelDNA and NetOffice
- In both cases enabling of context menu items worked well with Office 2010 and stopped working with Office 2013.
I have submitted the defect for Visual Studio and .NET Framework area on MS Connect as I have not found where they accept bugs for Office.
As on MS Connect some times links to defects appear broken - I will add details of the defect with screenshots in the end of this answer.
Work around - to enable disable menu item
As it was stated in answer to your question on MSDN Social forum - you can control Enabled
state of context menu items when you retrieve items by Caption
or by Tag
property:
CommandBar contextMenu = Globals.ThisAddIn.Application.CommandBars["Cell"];
foreach (CommandBarControl control in contextMenu.Controls)
{
if (control.Caption == "item caption") // Specify here caption of your context menu item
{
contextMenuItem = (CommandBarButton)control;
contextMenuItem.Enabled = true; // Specify here desired value for Enabled state to be set
}
}
In above code snipped context menu item is found by Caption
- to find item by Tag
replace code:
control.Caption == "item caption"
in if
condition with:
control.Tag == "item tag"
specifying proper value instead of item tag
text
Defect details
MS Connect ticket has ID 813453 and title:
Enabled state does not change for context menu items of Excel 2013 add-in created with C# .NET and Visual Studio 2012
Below are screenshots of the ticket: