TreeView::LevelStyles Property
Gets a collection of Style objects that represent the node styles at the individual levels of the tree.
Assembly: System.Web (in System.Web.dll)
public: [PersistenceModeAttribute(PersistenceMode::InnerProperty)] property TreeNodeStyleCollection^ LevelStyles { TreeNodeStyleCollection^ get(); }
Property Value
Type: System.Web.UI.WebControls::TreeNodeStyleCollection^A StyleCollection that represents the node styles at the individual levels of the tree.
Use the LevelStyles collection as an alternative to the individual style properties (such as the NodeStyle property) to control the style of nodes at the individual levels of the tree. The first style in the collection corresponds to the style of nodes in the first level of the tree. The second style in the collection corresponds to the style of nodes in the second level of the tree, and so on. This property is most often used to generate table of contents–style navigation menus where nodes at a certain level should have the same appearance, regardless of whether they have child nodes.
Style properties are applied in the following order:
RootNodeStyle, ParentNodeStyle, or LeafNodeStyle, depending on the node type. If the LevelStyles collection is defined, it is applied at this time, overriding the other node style properties.
The following code example demonstrates how to use the LevelStyles property to create a navigation menu. The control is always fully expanded, with the expansion node indicators and images hidden. Also, the ChildNodesPadding property is used to control the spacing of the node levels.
Available since 2.0