Infragistics2.Win.UltraWinTree.v8.1
ShowExpansionIndicator Property
See Also  Example
Infragistics.Win.UltraWinTree Namespace > Override Class : ShowExpansionIndicator Property

Gets/sets a value indicating whether expansion indicators (plus-sign (+) and minus-sign (-) buttons are displayed next to tree nodes that contain child tree nodes.

Syntax

Visual Basic (Declaration) 
Public Property ShowExpansionIndicator As ShowExpansionIndicator
C# 
public ShowExpansionIndicator ShowExpansionIndicator {get; set;}

Remarks

This property determines when a node will display an expansion indicator.

When set to the Default or CheckOnLoad, nodes will automatically determine whether an expansion indicator is necessary based on whether or not there are child nodes.

To load nodes "on demand", use the CheckOnExpand setting. With this setting, the node will show an expansion indicator until the first time it is expanded. At that time, the UltraTree.BeforeExpand event will fire. If the event completes successfully and is not cancelled, then the node will determine if any child nodes were added. If child nodes were added, the node will expand normally and show an expansion indicator. If no children were added, the expansion indicator will disappear and the node will not expand.

To restore the expansion indicator of a node once it has disappeared, use the UltraTree.ResetExpansionIndicator method of the UltraTree.

When loading nodes on demand, it is generally recommended to also set NodeDoubleClickAction to ToggleExpansionWhenExpansionIndicatorVisible.

Example

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

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

    Private Sub button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button8.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.

        ' Use the tree's Override property to
        ' set the default for all nodes.
        Me.ultraTree1.Override.NodeStyle = NodeStyle.CheckBox
        Me.ultraTree1.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnDisplay
        Me.ultraTree1.Override.TipStyleNode = TipStyleNode.Show
        ' Resrve space for checkboxes even if the node is't that style
        Me.ultraTree1.Override.ReserveCheckBoxSpace = DefaultableBoolean.True

        ' 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).NodeStyle = NodeStyle.Standard
        Me.ultraTree1.NodeLevelOverrides(2).TipStyleNode = TipStyleNode.Hide
        Me.ultraTree1.NodeLevelOverrides(2).ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand

        ' Set the default for nodes at the root level.
        ' This overrides the default settings above.
        Me.ultraTree1.Nodes.Override.NodeStyle = NodeStyle.CheckBoxTriState

        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.NodeStyle = NodeStyle.Standard

        ' Set the property for that specific node's child nodes
        node.Nodes.Override.NodeStyle = NodeStyle.OptionButton

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

       
private void button8_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.

           
// Use the tree's Override property to
           
// set the default for all nodes.
           
this.ultraTree1.Override.NodeStyle = NodeStyle.CheckBox;
           
this.ultraTree1.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnDisplay;
           
this.ultraTree1.Override.TipStyleNode = TipStyleNode.Show;
           
// Resrve space for checkboxes even if the node is't that style
           
this.ultraTree1.Override.ReserveCheckBoxSpace = DefaultableBoolean.True;
       
           
// 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].NodeStyle = NodeStyle.Standard;
           
this.ultraTree1.NodeLevelOverrides[2].TipStyleNode = TipStyleNode.Hide;
           
this.ultraTree1.NodeLevelOverrides[2].ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;

           
// Set the default for nodes at the root level.
           
// This overrides the default settings above.
           
this.ultraTree1.Nodes.Override.NodeStyle = NodeStyle.CheckBoxTriState;

           
// 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.NodeStyle = NodeStyle.Standard;

           
// Set the property for that specific node's child nodes
           
node.Nodes.Override.NodeStyle = NodeStyle.OptionButton;
       
       }

See Also