Note: When the ViewStyle property is set to 'OutlookExpress', the value of the ShowLines property is not applicable; node connector lines are never displayed for the 'OutlookExpress' view style.
The following sample code initializes various properties on an UltraWinTree control and illustrates how to populate the tree.
Imports Infragistics.Win.UltraWinTree Private Sub InitializeTreeControl() With Me.ultraTree1 ' Set various properties on the tree control ' Specify whether the tree will scroll during a ' drag operation .AllowAutoDragScrolling = True ' Specify whether the tree will look for the ' next matching node as the user types. .AllowKeyboardSearch = True ' Specify the amount of milliseconds to wait ' before expanding a node during a drag ' operation. .AutoDragExpandDelay = 500 ' Set the border style of the control .BorderStyle = Infragistics.Win.UIElementBorderStyle.InsetSoft ' Specify whether clicking anywhere on the ' row the node is on will select the node. .FullRowSelect = False ' Specify whether selected nodes remain ' highlighted when the tree loses focus. .HideSelection = True ' Specify the padding around images in pixels. .ImagePadding = 3 ' Specify how many pixels to indent each ' node level. .Indent = 8 ' Specify the default size of images that will ' appear to the left and right of a node's text. .LeftImagesSize = New Size(12, 12) .RightImagesSize = New Size(8, 8) ' Specify the style and color os the node ' connector lines. .NodeConnectorColor = Color.Red .NodeConnectorStyle = NodeConnectorStyle.Dotted ' Specify the string to be used to separate ' ancestor nodes when getting a node's ' 'FullPath' property. For example: 'Me.ultraTree1..ActiveNode.FullPath .PathSeparator = "\" ' Specify whether scrollbars will be shown .Scrollable = Scrollbar.ShowIfNeeded ' Specify whether lines will appear between nodes .ShowLines = True ' Specify whether room for lines and expansion ' indicators will be reserved to the left of root ' nodes (i.e. nodes without a parent node). ' ' Note: If the 'ShowLines' property is set to ' false then the root lines won't be visible ' even if the 'ShowRootLines' property is true. ' In that case just the expansion indicators ' will show. .ShowRootLines = True ' Add a root node Dim node As UltraTreeNode Dim childNode As UltraTreeNode node = .Nodes.Add("Node 1") ' Add some child nodes childNode = node.Nodes.Add("child node 1") childNode.Nodes.Add("child child 1") childNode.Nodes.Add("child child 2") childNode.Nodes.Add("child child 3") ' Add some grandchild nodes childNode = node.Nodes.Add("child node 2") childNode = node.Nodes.Add("child node 3") ' Disable the node childNode.Enabled = False childNode = node.Nodes.Add("child node 4") ' Add another root node node = .Nodes.Add("Node 2") ' Activate the last child node added .ActiveNode = childNode ' Bring the active node into view .ActiveNode.BringIntoView() End With End Sub
using Infragistics.Win.UltraWinTree; private void InitializeTreeControl() { // Set various properties on the tree control // Specify whether the tree will scroll during a // drag operation this.ultraTree1.AllowAutoDragScrolling = true; // Specify whether the tree will look for the // next matching node as the user types. this.ultraTree1.AllowKeyboardSearch = true; // Specify the amount of milliseconds to wait // before expanding a node during a drag // operation. this.ultraTree1.AutoDragExpandDelay = 500; // Set the border style of the control this.ultraTree1.BorderStyle = Infragistics.Win.UIElementBorderStyle.InsetSoft; // Specify whether clicking anywhere on the // row the node is on will select the node. this.ultraTree1.FullRowSelect = false; // Specify whether selected nodes remain // highlighted when the tree loses focus. this.ultraTree1.HideSelection = true; // Specify the padding around images in pixels. this.ultraTree1.ImagePadding = 3; // Specify how many pixels to indent each // node level. this.ultraTree1.Indent = 8; // Specify the default size of images that will // appear to the left and right of a node's text. this.ultraTree1.LeftImagesSize = new Size(12,12); this.ultraTree1.RightImagesSize = new Size(8,8); // Specify the style and color os the node // connector lines. this.ultraTree1.NodeConnectorColor = Color.Red; this.ultraTree1.NodeConnectorStyle = NodeConnectorStyle.Dotted; // Specify the string to be used to separate // ancestor nodes when getting a node's // 'FullPath' property. For example: //this.ultraTree1.ActiveNode.FullPath; this.ultraTree1.PathSeparator = @"\"; // Specify whether scrollbars will be shown this.ultraTree1.Scrollable = Scrollbar.ShowIfNeeded; // Specify whether lines will appear between nodes this.ultraTree1.ShowLines = true; // Specify whether room for lines and expansion // indicators will be reserved to the left of root // nodes (i.e. nodes without a parent node). // // Note: If the 'ShowLines' property is set to // false then the root lines won't be visible // even if the 'ShowRootLines' property is true. // In that case just the expansion indicators // will show. this.ultraTree1.ShowRootLines = true; // Add a root node UltraTreeNode node = this.ultraTree1.Nodes.Add("Node 1"); // Add some child nodes UltraTreeNode childNode = node.Nodes.Add("child node 1"); childNode.Nodes.Add("child child 1"); childNode.Nodes.Add("child child 2"); childNode.Nodes.Add("child child 3"); // Add some grandchild nodes childNode = node.Nodes.Add("child node 2"); childNode = node.Nodes.Add("child node 3"); // Disable the node childNode.Enabled = false; childNode = node.Nodes.Add("child node 4"); // Add another root node node = this.ultraTree1.Nodes.Add("Node 2"); // Activate the last child node added this.ultraTree1.ActiveNode = childNode; // Bring the active node into view this.ultraTree1.ActiveNode.BringIntoView(); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2