Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TreeView::LevelStyles Property

Gets a collection of Style objects that represent the node styles at the individual levels of the tree.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
public:
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:

  1. NodeStyle.

  2. 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.

  3. SelectedNodeStyle.

  4. HoverNodeStyle

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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.