Menu class
SharePoint 2013
Represents the menu for a Web Part.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
The following code example shows an overridden CreateWebPartMenuThat includes two custom Boolean properties, ParentItemIsVisible and EnableItem1, that allow you to control when these menu items are visible and enabled. It also assumes that this method is part of a Web Part class that includes an event handler named EventHandlerForItem1.
Show: