TreeView::SelectedNodeStyle Property

 

Gets the TreeNodeStyle object that controls the appearance of the selected node in the TreeView control.

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

public:
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
property TreeNodeStyle^ SelectedNodeStyle {
	TreeNodeStyle^ get();
}

Property Value

Type: System.Web.UI.WebControls::TreeNodeStyle^

A TreeNodeStyle that represents the style of the selected node in the TreeView control. The default is null, which indicates that the SelectedNodeStyle property is not set.

Use the SelectedNodeStyle property to control the appearance of the selected node in the TreeView control. This property is read-only; however, you can set the properties of the TreeNodeStyle object it returns. The properties can be set declaratively in the form Property-Subproperty, where Subproperty is a property of the TreeNodeStyle object (for example, SelectedNodeStyle-ForeColor). The properties can also be set programmatically in the form Property.Subproperty (for example, SelectedNodeStyle.ForeColor). Common settings usually include a custom background color, foreground color, font properties, and node spacing. Style properties are applied in the following order of precedence:

  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 SelectedNodeStyle property to control the appearance of the selected node in the TreeView control.

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

.NET Framework
Available since 2.0
Return to top
Show: