MWSNewMenu Class
Namespace:
Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
MWSNewMenu
Description
The Microsoft.SharePoint.WebControls.MWSNewMenu class inherits from the Microsoft.SharePoint.WebControls.NewMenu class which is responsible for displaying a "New" menu on a WebPart or Control. As with the NewMenu class, the default menu items can be overridden and the menu is depending on the current context.
It should be noted that the MWS class name prefix, as with other similarly decorated classes denotes that this class provides a Meeting Workspace implementation of a pre-existing SharePoint class (MWS<classname>).
The MWSActionsMenu control promotes its implementation by overriding the ToolBarMenuButton.AddMenuItems method, which is accountable for adding MenuItemTemplate objects to the parent object. Within the override, there are specific mechanisms to support the MenuItemTemplate with object ID "New0" (the standard new button).
Usage Scenarios
The MWSNewMenu class finds primary usage in combination with the ToolBar class. Often it is used by being added to the ToolBarButtons.Controls collection, and the ToolBar being added subsentutly added to an instance control collection.
In the below, I have an exclusive method that builds a new MWSNewMenu object with all appropriate property designation. I am also showing an override of the default menu items by using the derived Microsoft.SharePoint.WebControls.ToolBarMenuButton.AddMenuItem method in order to add a new menu item that interrogates some of the control properties. This object could subsequently be added to another control collection for rendering.
C# Code Sample
private MWSNewMenu ExampleMWSNewMenu;
private NewMenu CreateMWSNewMenu()
{
ExampleMWSNewMenu = new MWSNewMenu();
ExampleMWSNewMenu.ID = "ExampleNewMenu";
ExampleMWSNewMenu.Text = "ExampleNewMenu";
ExampleMWSNewMenu.AlignToParent = true;
ExampleMWSNewMenu.MenuAlignment = MenuAlignment.Right;
ExampleMWSNewMenu.AddMenuItem("Adam", "Buenz", "", "Adam Buenz Is A WSS MVP." + ExampleMWSNewMenu.Controls[0] + ExampleMWSNewMenu.Controls.Count, "", "");
return ExampleMWSNewMenu;
}
Visual Basic .NET Code Sample
Private ExampleMWSNewMenu As MWSNewMenu
Private Function CreateMWSNewMenu() As NewMenu
ExampleMWSNewMenu = New MWSNewMenu()
ExampleMWSNewMenu.ID = "ExampleNewMenu"
ExampleMWSNewMenu.Text = "ExampleNewMenu"
ExampleMWSNewMenu.AlignToParent = True
ExampleMWSNewMenu.MenuAlignment = MenuAlignment.Right
ExampleMWSNewMenu.AddMenuItem("Adam", "Buenz", "", "Adam Buenz Is A WSS MVP." + ExampleMWSNewMenu.Controls(0) + ExampleMWSNewMenu.Controls.Count, "", "")
Return ExampleMWSNewMenu
End Function
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.MWSNewMenu class inherits from the Microsoft.SharePoint.WebControls.NewMenu class which is responsible for displaying a "New" menu on a WebPart or Control. As with the NewMenu class, the default menu items can be overridden and the menu is depending on the current context.
It should be noted that the MWS class name prefix, as with other similarly decorated classes denotes that this class provides a Meeting Workspace implementation of a pre-existing SharePoint class (MWS<classname>).
The MWSActionsMenu control promotes its implementation by overriding the ToolBarMenuButton.AddMenuItems method, which is accountable for adding MenuItemTemplate objects to the parent object. Within the override, there are specific mechanisms to support the MenuItemTemplate with object ID "New0" (the standard new button).
Usage Scenarios
The MWSNewMenu class finds primary usage in combination with the ToolBar class. Often it is used by being added to the ToolBarButtons.Controls collection, and the ToolBar being added subsentutly added to an instance control collection.
In the below, I have an exclusive method that builds a new MWSNewMenu object with all appropriate property designation. I am also showing an override of the default menu items by using the derived Microsoft.SharePoint.WebControls.ToolBarMenuButton.AddMenuItem method in order to add a new menu item that interrogates some of the control properties. This object could subsequently be added to another control collection for rendering.
C# Code Sample
private MWSNewMenu ExampleMWSNewMenu;
private NewMenu CreateMWSNewMenu()
{
ExampleMWSNewMenu = new MWSNewMenu();
ExampleMWSNewMenu.ID = "ExampleNewMenu";
ExampleMWSNewMenu.Text = "ExampleNewMenu";
ExampleMWSNewMenu.AlignToParent = true;
ExampleMWSNewMenu.MenuAlignment = MenuAlignment.Right;
ExampleMWSNewMenu.AddMenuItem("Adam", "Buenz", "", "Adam Buenz Is A WSS MVP." + ExampleMWSNewMenu.Controls[0] + ExampleMWSNewMenu.Controls.Count, "", "");
return ExampleMWSNewMenu;
}
Visual Basic .NET Code Sample
Private ExampleMWSNewMenu As MWSNewMenu
Private Function CreateMWSNewMenu() As NewMenu
ExampleMWSNewMenu = New MWSNewMenu()
ExampleMWSNewMenu.ID = "ExampleNewMenu"
ExampleMWSNewMenu.Text = "ExampleNewMenu"
ExampleMWSNewMenu.AlignToParent = True
ExampleMWSNewMenu.MenuAlignment = MenuAlignment.Right
ExampleMWSNewMenu.AddMenuItem("Adam", "Buenz", "", "Adam Buenz Is A WSS MVP." + ExampleMWSNewMenu.Controls(0) + ExampleMWSNewMenu.Controls.Count, "", "")
Return ExampleMWSNewMenu
End Function
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP