MenuFormat Enumeration
Specifies the display format of a Menu control.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
| Member name | Description | |
|---|---|---|
| None | Indicates that there is no menu format. | |
| ArrowOnHover | The menu only shows text or a link, depending on the value of the NavigateUrl property. When in focus or when the mouse pointer is resting on it, the menu is highlighted and displays the down arrow. | |
| ArrowAlwaysVisible | The menu always shows a down arrow and is highlighted when in focus or when the mouse pointer is resting on it. | |
| ArrowAlwaysVisibleDark | The menu always shows a down arrow and is highlighted when in focus or when the mouse pointer is resting on it. | |
| ArrowSplitButton | The menu always shows a down arrow and is highlighted and the button split when in focus or when the mouse pointer is resting on it.. | |
| ArrowAlwaysVisibleWithAlternateHover | The menu always shows a down arrow, but shows a different down arrow image when in focus or when the mouse pointer is resting on it. |
MenuFormat
Description
The Microsoft.SharePoint.WebControls.MenuFormat exposes enumerators translating to different SharePoint menu formatting types for Microsoft.SharePoint.WebControls.Menu objects. Each Menu object has a MenuFormat property that translates to a value specified in the enumeration. The assorted enumerators specify certain display attributes around the Menu, tiered around pointer display.
The MenuFormat enumeration contains the following enumerators:
MenuFormat.None – no modifications to menu format
MenuFormat.ArrowOnHover –arrow on hover
MenuFormat.ArrowAlwaysVisible – arrow is continually visible
MenuFormat.ArrowAlwaysVisibleDark – dark edge arrow is continually visible
MenuFormat.ArrowSplitButton – arrow with support for buttons that contain two separate click areas
Usage Scenario
The usage of the MenuFormat enumeration is when building Microsoft.SharePoint.WebControls.Menu objects, used to hydrate the Menu.MenuFormat property. The enumeration is common in custom classes that inherit from assorted menu base classes, such as the ToolBarMenuButton class for making custom menus for the standard toolbar.
In the below, I am firstly demonstrating basic Menu object creation and setting of the Menu.MenuFormat property by using the MenuFormat enumeration. Secondly, I demonstrate how a custom class inheriting from the ToolBarMenuButtton class could be set to a specific format by overriding the SetMenuItemProperties method and specifying a value out of the MenuFormat enumeration.
C# Code Example
protected override void CreateChildControls()
{
Menu menu = new Menu();
menu.Text = "Menu";
menu.MenuFormat = MenuFormat.ArrowOnHover;
Controls.Add(menu);
}
public class MyButton : ToolBarMenuButton
{
protected override void SetMenuItemProperties()
{
if (MenuControl != null)
{
MenuControl.MenuFormat = MenuFormat.ArrowSplitButton;
}
}
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim menu As New Menu()
menu.Text = "Menu"
menu.MenuFormat = MenuFormat.ArrowOnHover
Controls.Add(menu)
End Sub
Public Class MyButton
Inherits ToolBarMenuButton
Protected Overloads Overrides Sub SetMenuItemProperties()
If MenuControl IsNot Nothing Then
MenuControl.MenuFormat = MenuFormat.ArrowSplitButton
End If
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.MenuFormat exposes enumerators translating to different SharePoint menu formatting types for Microsoft.SharePoint.WebControls.Menu objects. Each Menu object has a MenuFormat property that translates to a value specified in the enumeration. The assorted enumerators specify certain display attributes around the Menu, tiered around pointer display.
The MenuFormat enumeration contains the following enumerators:
MenuFormat.None – no modifications to menu format
MenuFormat.ArrowOnHover –arrow on hover
MenuFormat.ArrowAlwaysVisible – arrow is continually visible
MenuFormat.ArrowAlwaysVisibleDark – dark edge arrow is continually visible
MenuFormat.ArrowSplitButton – arrow with support for buttons that contain two separate click areas
Usage Scenario
The usage of the MenuFormat enumeration is when building Microsoft.SharePoint.WebControls.Menu objects, used to hydrate the Menu.MenuFormat property. The enumeration is common in custom classes that inherit from assorted menu base classes, such as the ToolBarMenuButton class for making custom menus for the standard toolbar.
In the below, I am firstly demonstrating basic Menu object creation and setting of the Menu.MenuFormat property by using the MenuFormat enumeration. Secondly, I demonstrate how a custom class inheriting from the ToolBarMenuButtton class could be set to a specific format by overriding the SetMenuItemProperties method and specifying a value out of the MenuFormat enumeration.
C# Code Example
protected override void CreateChildControls()
{
Menu menu = new Menu();
menu.Text = "Menu";
menu.MenuFormat = MenuFormat.ArrowOnHover;
Controls.Add(menu);
}
public class MyButton : ToolBarMenuButton
{
protected override void SetMenuItemProperties()
{
if (MenuControl != null)
{
MenuControl.MenuFormat = MenuFormat.ArrowSplitButton;
}
}
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim menu As New Menu()
menu.Text = "Menu"
menu.MenuFormat = MenuFormat.ArrowOnHover
Controls.Add(menu)
End Sub
Public Class MyButton
Inherits ToolBarMenuButton
Protected Overloads Overrides Sub SetMenuItemProperties()
If MenuControl IsNot Nothing Then
MenuControl.MenuFormat = MenuFormat.ArrowSplitButton
End If
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP