TreeNodeStyleCollection Class

 

Represents a collection of TreeNodeStyle objects that is in a TreeView control.

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

System.Object
  System.Web.UI.StateManagedCollection
    System.Web.UI.WebControls.TreeNodeStyleCollection

public sealed class TreeNodeStyleCollection : StateManagedCollection

NameDescription
System_CAPS_pubpropertyCount

Gets the number of elements contained in the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubpropertyItem[Int32]

Gets or sets the TreeNodeStyle object at the specified index in the TreeNodeStyleCollection object.

NameDescription
System_CAPS_pubmethodAdd(TreeNodeStyle)

Appends the specified TreeNodeStyle object to the end of the TreeNodeStyleCollection object.

System_CAPS_pubmethodClear()

Removes all items from the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubmethodContains(TreeNodeStyle)

Determines whether the specified TreeNodeStyle object is in the collection.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the elements of the StateManagedCollection collection to an array, starting at a particular array index.(Inherited from StateManagedCollection.)

System_CAPS_pubmethodCopyTo(TreeNodeStyle[], Int32)

Copies all the items from the TreeNodeStyleCollection object to a compatible one-dimensional array of TreeNodeStyle objects, starting at the specified index in the target array.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an iterator that iterates through the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(TreeNodeStyle)

Determines the index of the specified TreeNodeStyle object in the collection.

System_CAPS_pubmethodInsert(Int32, TreeNodeStyle)

Inserts the specified TreeNodeStyle object into the TreeNodeStyleCollection object at the specified index location.

System_CAPS_pubmethodRemove(TreeNodeStyle)

Removes the specified TreeNodeStyle object from the TreeNodeStyleCollection object.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the TreeNodeStyle object at the specified index location from the TreeNodeStyleCollection object.

System_CAPS_pubmethodSetDirty()

Forces the entire StateManagedCollection collection to be serialized into view state. (Inherited from StateManagedCollection.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns an iterator that iterates through the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Add(Object)

Adds an item to the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Clear()

This API supports the product infrastructure and is not intended to be used directly from your code. Removes all items from the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Contains(Object)

Determines whether the StateManagedCollection collection contains a specific value.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.IndexOf(Object)

Determines the index of a specified item in the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Insert(Int32, Object)

Inserts an item into the StateManagedCollection collection at the specified index.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Remove(Object)

Removes the first occurrence of the specified object from the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.RemoveAt(Int32)

Removes the IStateManager element at the specified index.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.LoadViewState(Object)

Restores the previously saved view state of the StateManagedCollection collection and the IStateManager items it contains.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.SaveViewState()

Saves the changes to the StateManagedCollection collection and each IStateManager object it contains since the time the page was posted back to the server.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIStateManager.TrackViewState()

Causes the StateManagedCollection collection and each of the IStateManager objects it contains to track changes to their view state so they can be persisted across requests for the same page.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.Count

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the number of elements contained in the StateManagedCollection collection.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.IsSynchronized

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value indicating whether the StateManagedCollection collection is synchronized (thread safe). This method returns false in all cases.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.SyncRoot

This API supports the product infrastructure and is not intended to be used directly from your code. Gets an object that can be used to synchronize access to the StateManagedCollection collection. This method returns null in all cases.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.IsFixedSize

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value indicating whether the StateManagedCollection collection has a fixed size. This method returns false in all cases.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.IsReadOnly

This API supports the product infrastructure and is not intended to be used directly from your code. Gets a value indicating whether the StateManagedCollection collection is read-only.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.Item[Int32]

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the IStateManager element at the specified index.(Inherited from StateManagedCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIStateManager.IsTrackingViewState

Gets a value indicating whether the StateManagedCollection collection is saving changes to its view state.(Inherited from StateManagedCollection.)

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The TreeNodeStyleCollection class is used to store and manage a collection of TreeNodeStyle objects. The LevelStyles property, of type TreeNodeStyleCollection, stores the node styles for the individual levels of a tree.

The LevelStyles property is an alternative to the individual style properties, such as the NodeStyle property, that control node styles at different levels of the tree. The first style in the collection corresponds to the node style in the first level of the tree. The second style in the collection corresponds to the node style in the second level of the tree, and so on. The LevelStyles 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.

The TreeNodeStyleCollection class inherits most of its members from the StateManagedCollection class. For more information about the inherited members, see StateManagedCollection.

The following code example demonstrates how to use the TreeNodeStyleCollection class to specify the style settings for the individual levels of a TreeView control. Notice that the LevelStyles property returns a TreeNodeStyleCollection object.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

  <head runat="server">
    <title>TreeView LevelStyles Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <h3>TreeView LevelStyles Example</h3>

      <!-- Populate the LevelStyles collection of the TreeView control -->
      <!-- declaratively.                                              -->

      <asp:TreeView id="LinksTreeView"
        Font-Names= "Arial"
        ForeColor="Blue"
        ShowExpandCollapse="false"
        ExpandDepth="3"
        NodeIndent="0" 
        runat="server">

        <LevelStyles>

          <asp:TreeNodeStyle ChildNodesPadding="10" 
            Font-Bold="true" 
            Font-Size="12pt" 
            ForeColor="DarkGreen"/>
          <asp:TreeNodeStyle ChildNodesPadding="5" 
            Font-Bold="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="5" 
            Font-UnderLine="true" 
            Font-Size="10pt"/>
          <asp:TreeNodeStyle ChildNodesPadding="10" 
            Font-Size="8pt"/>

        </LevelStyles>

        <Nodes>

          <asp:TreeNode Text="Table of Contents"
            SelectAction="None">

            <asp:TreeNode Text="Chapter One">

              <asp:TreeNode Text="Section 1.0">

                <asp:TreeNode Text="Topic 1.0.1"/>
                <asp:TreeNode Text="Topic 1.0.2"/>
                <asp:TreeNode Text="Topic 1.0.3"/>

              </asp:TreeNode>

              <asp:TreeNode Text="Section 1.1">

                <asp:TreeNode Text="Topic 1.1.1"/>
                <asp:TreeNode Text="Topic 1.1.2"/>
                <asp:TreeNode Text="Topic 1.1.3"/>
                <asp:TreeNode Text="Topic 1.1.4"/>

              </asp:TreeNode>

            </asp:TreeNode>

            <asp:TreeNode Text="Chapter Two">

              <asp:TreeNode Text="Section 2.0">

                <asp:TreeNode Text="Topic 2.0.1"/>
                <asp:TreeNode Text="Topic 2.0.2"/>

              </asp:TreeNode>

            </asp:TreeNode>

          </asp:TreeNode>
          <asp:TreeNode Text="Appendix A" />
          <asp:TreeNode Text="Appendix B" />
          <asp:TreeNode Text="Appendix C" />

        </Nodes>

      </asp:TreeView>

    </form>
  </body>
</html>

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: