MenuItemStyle.VerticalPadding Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the amount of space above and below a menu item's text.
public:
property System::Web::UI::WebControls::Unit VerticalPadding { System::Web::UI::WebControls::Unit get(); void set(System::Web::UI::WebControls::Unit value); };
public System.Web.UI.WebControls.Unit VerticalPadding { get; set; }
member this.VerticalPadding : System.Web.UI.WebControls.Unit with get, set
Public Property VerticalPadding As Unit
Property Value
The amount of space (in pixels) above and below a menu item's text. The default is 0.
Exceptions
Examples
The following code example demonstrates how to use the VerticalPadding property to pad the vertical spacing around the text of a menu item by 10 pixels.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MenuItemStyle VerticalPadding Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItemStyle VerticalPadding Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
runat="server">
<staticmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<dynamicmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MenuItemStyle VerticalPadding Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuItemStyle VerticalPadding Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
runat="server">
<staticmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<dynamicmenuitemstyle verticalpadding="10"
backcolor="LightBlue"/>
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>
Remarks
Use the VerticalPadding property to control the amount of vertical space around the text of the menu item to which the MenuItemStyle object is applied. This space is inserted between the upper edge of the text and the border of the text area, as well as between the lower edge of the text and the text's border. To control the horizontal spacing, use the HorizontalPadding property.