ComponentOne WebMenus and WebBars for ASP.NET: C1WebMenu Overview > Menu and Menu Item Styles

Menu and Menu Item Styles

The way C1WebCommand2 menus and menu items look can be customized using styles. Both menus and menu items are Web Controls, and as such both have ControlStyle property where colors, fonts and other display attributes can be defined.

C1WebCommand2 defines a special class C1WebItemStyle which (in addition to the .NET framework’s standard System.Web.UI.WebControls.Style class) is used to determine the look of menu items. The C1WebItemStyle class encapsulates properties relevant to the display of menu items, and is in many respects similar to the System.Web.UI.WebControls.Style class. Please see Defining the GroupStyle and ItemStyle Classes for details.

The following properties affect how a particular menu or menu item look:

      Menu’s ControlStyle. Style attributes defined by this property are applied to the HTML element of the menu itself. Because menu items are HTML children of the menu element, their look is also influenced by this style.

      Menu’s ItemStyle. Style attributes defined by this property are applied to HTML elements of the child items in normal state.

      Menu item’s ControlStyle. Style attributes defined by this property are applied to the HTML element of the menu item. Attributes defined by this property (if set) override same attributes defined by the ItemStyle of the parent menu.

      When an item in a menu is selected, menu’s SelectedItemStyle is applied to the item.

      If an item in a menu is disabled, menu’s DisabledItemStyle and item’s own DisabledItemStyle are applied to the item (in that order).

      Finally note, that in addition to (or instead of) specifying individual style attributes (such as color), for all style properties you can specify the name of the CSS class (C1WebCustomItemStyle.CssClass property), and the style corresponding to that class will be applied to the item. Inheritance rules described above apply toC1WebCustomItemStyle.CssClass also.


Send comments about this topic to ComponentOne.
Copyright © 1987-2009 ComponentOne LLC. All rights reserved.