This topic has not yet been rated - Rate this topic

GlobalGalleryActionsMenu Class

Represents an Action Menu in the Global Gallery.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class GlobalGalleryActionsMenu : ActionsMenu
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
GlobalGalleryActionsMenu
Description

Microsoft.SharePoint.WebControls.GlobalGalleryActionsMenu inherits from the Microsoft.SharePoint.WebControls.ActionsMenu class which sponsors an "Actions" menu. As the default menu items presented for an ActionsMenu control are context dependent, there are specific MenuItemTemplate objects within the derived GlobalGalleryActionsMenu class.

GlobalGalleryActionsMenu works by providing a series of MenuItemTemplate objects that are common to all galleries. The three menu items are "EditInGridButton",“ExportToDatabase", and “ViewRSS". 

The GlobalGalleryActionsMenu control promotes its implementation by overriding the ToolBarMenuButton.SetMenuItemProperties method, which is accountable for setting specific MenuItemTemplate object properties. Within this method, there are conditional checks to ensure the proper MenuItemTemplate objects are displayed.

The Usage Scenario

The primary usage of GlobalGalleryActionsMenu is internal since it is used for galleries, as internal stores galleries are rarely customized. Regardless, GlobalGalleryActionsMenu can be used in the same manner as any other WebControl by adding it to a control collection or as a base class. 

In the below, I am demonstrating instantiating a new GlobalGalleryActionsMenu object and giving it a unique identifier. Following I am adding the object to the current instance control collection.

In the GalleryInherit class I am inheriting from the GlobalGalleryActionsMenu class and overriding the SetMenuItemProperties method and using the GetMenuItem method to get a reference to a MenuItemTemplate object. Following, I am setting the identifier of that control as an arbitary property setting example.

C# Code Example

public class ExampleWebPart : WebPart
{
protected override void CreateChildControls()
{
GlobalGalleryActionsMenu gallery = new GlobalGalleryActionsMenu();
gallery.ID = "MyGallery";
Controls.Add(gallery);
}


public class GalleryInherit : GlobalGalleryActionsMenu
{
protected override void SetMenuItemProperties()
{
MenuItemTemplate menuItem = GetMenuItem("My_Menu_Item");
menuItem.ID = "My New ID";
base.SetMenuItemProperties();
}
}

Visual Basic .NET Code Example

Public Class ExampleWebPart
Inherits WebPart
Protected Overloads Overrides Sub CreateChildControls()
Dim gallery As New GlobalGalleryActionsMenu()
gallery.ID = "MyGallery"
Controls.Add(gallery)
End Sub
End Class 
Public Class GalleryInherit
Inherits GlobalGalleryActionsMenu
Protected Overloads Overrides Sub SetMenuItemProperties()
Dim menuItem As MenuItemTemplate = GetMenuItem("My_Menu_Item")
menuItem.ID = "My New ID"
MyBase.SetMenuItemProperties()
End Sub
End Class

Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com