Infragistics2.Win.UltraWinTree.v8.1
NodeLevelOverridesCollection Class
See Also  Members   Example 
Infragistics.Win.UltraWinTree Namespace : NodeLevelOverridesCollection Class

Collection of NodeLevelOverride objects.

Object Model

Syntax

Visual Basic (Declaration) 
Public Class NodeLevelOverridesCollection 
   Inherits SubObjectsCollectionBase
C# 
public class NodeLevelOverridesCollection : SubObjectsCollectionBase 

Remarks

This collection supports lazy creates. This means that items in the collection can be referenced without explicitly calling the Add Method and no error will be generated. The items will automatically be created as needed.

Each Override in the collection affects all nodes in the UltraTree whose level matches the Index of the item in the collection. So NodeLevelOverrides(0) applies to all root nodes, NodeLevelOverrides(1) applies to all children of the root, NodeLevelOverrides(2) applies to greanchildren of the root, and so on.

This collection is not limited by the actual nodes in the UltraTree. It is possible to create a NodeLevelOverride with an index higher than the number of levels in the UltraTree.

Example

The following sample code illustrates how to specify the appearance of nodes.

Visual BasicCopy Code
    Imports Infragistics.Win
    Imports Infragistics.Win.UltraWinTree

    Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click

        ' Note: the Override objects are exposed as properties off
        ' the tree, the node and the nodes collection as well as
        ' items in the NodeLevelOverrides collection. This allows
        ' default settings to be specified for the tree, a node,
        ' a node's children or for a level in the tree.

        ' Get the tree's Override property so we can
        ' set the default for all nodes.
        With Me.ultraTree1.Override

            ' Turn hot tracking on
            .HotTracking = DefaultableBoolean.True

            ' Set the borderstyle to solid but the border color
            ' to trasnparent so the borders don't show by default.
            .BorderStyleNode = UIElementBorderStyle.Solid
            .NodeAppearance.BorderColor = Color.Transparent

            ' Set default border colors for active, expanded,
            ' hot tracked and selected nodes.
            .ActiveNodeAppearance.BorderColor = Color.Red
            .ExpandedNodeAppearance.BorderColor = Color.Magenta
            .HotTrackingNodeAppearance.BorderColor = Color.Blue
            .SelectedNodeAppearance.BorderColor = Color.Black

        End With

        ' Set the default for nodes that are at level 2
        ' (i.e. grandchild nodes of root modes).
        ' This overrides the default setting above.
        Me.ultraTree1.NodeLevelOverrides(2).ActiveNodeAppearance.BorderColor = Color.Violet

        ' Set the default for nodes at the root level.
        ' This overrides the default settings above.
        Me.ultraTree1.Nodes.Override.ActiveNodeAppearance.BorderColor = Color.Aqua

        Dim node As UltraTreeNode

        ' Get a specific node by its key value.
        ' Note: this will return the node that has that key
        ' from anywhere in the tree structure since keys are
        ' unique across the entire tree.
        node = Me.ultraTree1.GetNodeByKey("child node 1")

        ' Set the property for that specific node only.
        ' This overrides any default settings above.
        node.Override.ActiveNodeAppearance.BorderColor = Color.Cyan

        ' Set the property for that specific node's child nodes
        node.Nodes.Override.ActiveNodeAppearance.BorderColor = Color.Beige

    End Sub
C#Copy Code
       using Infragistics.Win;
       
using Infragistics.Win.UltraWinTree;


       
private void button3_Click(object sender, System.EventArgs e)
       {

           
// Note: the Override objects are exposed as properties off
           
// the tree, the node and the nodes collection as well as
           
// items in the NodeLevelOverrides collection. This allows
           
// default settings to be specified for the tree, a node,
           
// a node's children or for a level in the tree.

           
Infragistics.Win.UltraWinTree.Override ovr;

           
// Get the tree's Override property so we can
           
// set the default for all nodes.
           
ovr = this.ultraTree1.Override;

           
// Turn hot tracking on
           
ovr.HotTracking = DefaultableBoolean.True;

           
// Set the borderstyle to solid but the border color
           
// to trasnparent so the borders don't show by default.
           
ovr.BorderStyleNode = UIElementBorderStyle.Solid;
           ovr.NodeAppearance.BorderColor = Color.Transparent;

           
// Set default border colors for active, expanded,
           
// hot tracked and selected nodes.
           
ovr.ActiveNodeAppearance.BorderColor = Color.Red;
           ovr.ExpandedNodeAppearance.BorderColor = Color.Magenta;
           ovr.HotTrackingNodeAppearance.BorderColor = Color.Blue;
           ovr.SelectedNodeAppearance.BorderColor = Color.Black;
       
           
// Set the default for nodes that are at level 2
           
// (i.e. grandchild nodes of root modes).
           
// This overrides the default setting above.
           
this.ultraTree1.NodeLevelOverrides[2].ActiveNodeAppearance.BorderColor = Color.Violet;

           
// Set the default for nodes at the root level.
           
// This overrides the default settings above.
           
this.ultraTree1.Nodes.Override.ActiveNodeAppearance.BorderColor = Color.Aqua;

           
// Get a specific node by its key value.
           
// Note: this will return the node that has that key
           
// from anywhere in the tree structure since keys are
           
// unique across the entire tree.
           
UltraTreeNode node = this.ultraTree1.GetNodeByKey("child node 1");

           
// Set the property for that specific node only.
           
// This overrides any default settings above.
           
node.Override.ActiveNodeAppearance.BorderColor = Color.Cyan;

           
// Set the property for that specific node's child nodes
           
node.Nodes.Override.ActiveNodeAppearance.BorderColor = Color.Beige;
       
       }

See Also