TreeView::NodeStyle Property
Gets a reference to the TreeNodeStyle object that allows you to set the default appearance of the nodes in the TreeView control.
Assembly: System.Web (in System.Web.dll)
public: [PersistenceModeAttribute(PersistenceMode::InnerProperty)] property TreeNodeStyle^ NodeStyle { TreeNodeStyle^ get(); }
Property Value
Type: System.Web.UI.WebControls::TreeNodeStyle^A reference to the TreeNodeStyle that represents the default style of a node.
Use the NodeStyle property to control the default appearance of a 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, NodeStyle-ForeColor). The properties can also be set programmatically in the form Property.Subproperty (for example, NodeStyle.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:
NodeStyle.
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.
Note |
|---|
The corresponding node style settings in the RootNodeStyle, ParentNodeStyle, or LeafNodeStyle properties override the style settings of the NodeStyle property. |
If you need 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, you might consider using the LevelStyles property instead of setting the individual style properties.
Available since 2.0
