WebPartMenuStyle Class
Collapse the table of content
Expand the table of content

WebPartMenuStyle Class

Note: This class is new in the .NET Framework version 2.0.

Contains style characteristics for menus on WebPart controls. This class cannot be inherited.

Namespace: System.Web.UI.WebControls.WebParts
Assembly: System.Web (in system.web.dll)

public sealed class WebPartMenuStyle : TableStyle, ICustomTypeDescriptor
public final class WebPartMenuStyle extends TableStyle implements ICustomTypeDescriptor
public final class WebPartMenuStyle extends TableStyle implements ICustomTypeDescriptor

The WebPartMenuStyle class is essentially a TableStyle object, which contains style characteristics to apply to menus on WebPart controls.

The Web Parts control set uses the WebPartMenuStyle object to determine the style characteristics of the verbs menu on a WebPart control. A verbs menu is contained in the title bar of each WebPart control, and it includes various user interface (UI) actions (called verbs) that users can perform, such as closing, minimizing, exporting, or deleting a control.


You can set style attributes on the WebPartMenuStyle object, and thus on the verbs menu of all the WebPart controls in a zone, by using the MenuPopupStyle property on a WebPartZoneBase zone.

The WebPartMenuStyle class has two important properties. The first is the HorizontalAlign property, which determines whether the content of the menu is aligned on the left, the center, or the right of the control or the alignment is not set. The ShadowColor property determines the color of the shadow for the menu on a WebPart control, if the menu shadowing feature is enabled on the user's system.

The WebPartMenuStyle class also has some critical methods. The CopyFrom method copies nonblank style elements from the style object passed into the method, and applies them to the WebPartMenuStyle object, overwriting any existing style elements in the process. The MergeWith method similarly copies nonblank style elements from the style object passed to the method, but it does not overwrite existing style elements in the WebPartMenuStyle object. The Reset method removes any defined style elements from the WebPartMenuStyle object's state bag.

The WebPartMenuStyle class also implements all the methods contained in the ICustomTypeDescriptor interface. In general, this enables the WebPartMenuStyle class to be applied to different types of menus.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft