Version

IncludeTextInFullPath Property

Gets/sets whether the value returned from the TextResolved property is used for this instance when determining the value returned from the GetFullPath method for descendant locations.
Syntax
'Declaration
 
Public Property IncludeTextInFullPath As Boolean
public bool IncludeTextInFullPath {get; set;}
Remarks

The IncludeTextInFullPath property makes it possible to preclude this location's text when constructing the navigation path for a descendant location. For example, if the navigation path represents a file path, it may be desirable to omit one or more high-level ancestors when constructing the path to an actual directory. Assuming the RootLocation represents the Windows Desktop, one of its child locations represents the "Computer" node, and descendants of the "Computer" node represent actual directories, setting IncludeTextInFullPath to false for the Desktop and Computer nodes makes it unnecessary for the end user to type "Desktop\Computer\C:\Program Files" when inputting a navigation path. The would then only have to type "C:\Program Files" to produce a parsable representation of the location, since the parsing logic will bypass the Desk and Computer nodes when constructing the path.

Explicitly setting the Text property to an empty string is the functional equivalent of setting IncludeTextInFullPath to false.

The GetFullPath method provides a way to include the text for all ancestors in the returned value, essentially ignoring the value of the IncludeTextInFullPath property.

Example
The following code sample demonstrates how to populate an UltraNavigationBar control and an UltraTree control with the contents of the local machine's file system:

Imports System
Imports System.Drawing
Imports System.IO
Imports System.Collections.Generic
Imports System.ComponentModel
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports Infragistics.Win.Misc.UltraWinNavigationBar
Imports Infragistics.Win.UltraWinTree

	Public Class FileSystemSupport
    	Private Const PATH_SEPARATOR As String = "\"
    	Private navigationBar As UltraNavigationBar = Nothing
    	Private tree As UltraTree = Nothing

    Public Sub Populate()

        '  Set up the root location to represent the 'Computer' location.
        Dim rootLocation As UltraNavigationBarLocation = Me.navigationBar.RootLocation

        '  Remove any existing members from the root's Locations collection.
        If (rootLocation.HasLocations) Then rootLocation.Locations.Clear()

        '  Clear the tree's Nodes collection and add the root node.
        Me.tree.Nodes.Clear()
        Dim rootNode As UltraTreeNode = Me.tree.Nodes.Add("Computer", "Computer")

        '  Set the Text for the root location and root node
        rootLocation.Text = rootNode.Text

        '  Note that we set the IncludeTextInFullPath property to false
        '  so that directory paths can be parsed without the end user
        '  having to type the name of the root. This will also prevent
        '  the text from appearing when the control is in edit mode.
        rootLocation.IncludeTextInFullPath = False

        '  Add the logical drives of this local machine to the root's Locations/Nodes collections.
        Dim locations As NavigationBarLocationsCollection = rootLocation.Locations
        Dim nodes As TreeNodesCollection = rootNode.Nodes

        '  Assign the appropriate image to the root location/node
        rootLocation.Settings.Appearance.Image = Me.GetImage(Images.Computer)
        rootNode.Override.NodeAppearance.Image = Me.GetImage(Images.Computer)

        Dim drives() As DriveInfo = DriveInfo.GetDrives()
        Dim i As Integer
        For i = 0 To drives.Length - 1

            Dim drive As DriveInfo = drives(i)

            '  Skip the drives we don't want to present to the end user.
            If (drive.DriveType = DriveType.Ram Or drive.DriveType = DriveType.NoRootDirectory Or drive.IsReady = False) Then
                Continue For
            End If

            '  Get the name of the drive, and remove the path separator.
            '  Also, get the volume name and use 'Local Disk' if none is assigned.
            Dim driveName As String = drive.Name
            driveName = driveName.Replace(PATH_SEPARATOR, String.Empty)
            Dim volumeLabel As String = drive.VolumeLabel
            volumeLabel = iif(Not volumeLabel Is Nothing AndAlso volumeLabel.Length > 0, volumeLabel, "Local Disk")

            '  Create a new UltraNavigationBarLocation instance, using the drive's name
            '  as the key, and the volume label/drive name as the DisplayText.
            Dim location As UltraNavigationBarLocation = New UltraNavigationBarLocation(driveName, driveName)

            '  Use the DisplayText property to format the combination of the drive letter
            '  and volume name so that we present it to the end user in a readable form.
            location.DisplayText = String.Format("{0} ({1})", volumeLabel, driveName)

            '  Add the location to the root's Locations collection.
            locations.Add(location)

            '  Add an accompanying tree node for the location we just added
            Dim node As UltraTreeNode = rootNode.Nodes.Add(location.Key, location.DisplayTextResolved)

            '  Assign the appropriate image to the location/node
            location.Settings.Appearance.Image = Me.GetImage(drive.DriveType)
            node.Override.NodeAppearance.Image = Me.GetImage(drive.DriveType)

            '  Assign an instance of a wrapper class which associates the node,
            '  location and directory to each object to the Tag property.
            node.Tag = New DirectoryWrapper(drive.RootDirectory, location)
            location.Tag = New DirectoryWrapper(drive.RootDirectory, node)
        Next

    End Sub

	End Class
using System;
using System.Drawing;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;
using Infragistics.Win.Misc.UltraWinNavigationBar;
using Infragistics.Win.UltraWinTree;

    public class FileSystemSupport
    {
        private static readonly string PATH_SEPARATOR = "\\";
        private UltraNavigationBar navigationBar = null;
        private UltraTree tree = null;

        public void Populate()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                //  Set up the root location to represent the 'Computer' location.
                UltraNavigationBarLocation rootLocation = this.navigationBar.RootLocation;
                
                //  Remove any existing members from the root's Locations collection.
                if ( rootLocation.HasLocations )
                    rootLocation.Locations.Clear();

                //  Clear the tree's Nodes collection and add the root node.
                this.tree.Nodes.Clear();
                UltraTreeNode rootNode = this.tree.Nodes.Add( "Computer", "Computer" );

                //  Set the Text for the root location and root node
                rootLocation.Text = rootNode.Text;

                //  Note that we set the IncludeTextInFullPath property to false
                //  so that directory paths can be parsed without the end user
                //  having to type the name of the root. This will also prevent
                //  the text from appearing when the control is in edit mode.
                rootLocation.IncludeTextInFullPath = false;
                
                //  Add the logical drives of this local machine to the root's Locations/Nodes collections.
                NavigationBarLocationsCollection locations = rootLocation.Locations;
                TreeNodesCollection nodes = rootNode.Nodes;

                //  Assign the appropriate image to the root location/node
                rootLocation.Settings.Appearance.Image = this.GetImage(Images.Computer);
                rootNode.Override.NodeAppearance.Image = this.GetImage(Images.Computer);

                DriveInfo[] drives = DriveInfo.GetDrives();
                for ( int i = 0; i < drives.Length; i ++ )
                {
                    DriveInfo drive = drives[i];
                    
                    //  Skip the drives we don't want to present to the end user.
                    if ( drive.DriveType == DriveType.Ram ||
                         drive.DriveType == DriveType.NoRootDirectory ||
                         drive.IsReady == false )
                        continue;

                    //  Get the name of the drive, and remove the path separator.
                    //  Also, get the volume name and use 'Local Disk' if none is assigned.
                    string driveName = drive.Name;
                    driveName = driveName.Replace( PATH_SEPARATOR, string.Empty );
                    string volumeLabel = drive.VolumeLabel;
                    volumeLabel = volumeLabel != null && volumeLabel.Length > 0 ? volumeLabel : "Local Disk";

                    //  Create a new UltraNavigationBarLocation instance, using the drive's name
                    //  as the key, and the volume label/drive name as the DisplayText.
                    UltraNavigationBarLocation location = new UltraNavigationBarLocation( driveName, driveName );

                    //  Use the DisplayText property to format the combination of the drive letter
                    //  and volume name so that we present it to the end user in a readable form.
                    location.DisplayText = string.Format("{0} ({1})", volumeLabel, driveName );

                    //  Add the location to the root's Locations collection.
                    locations.Add( location );

                    //  Add an accompanying tree node for the location we just added
                    UltraTreeNode node = rootNode.Nodes.Add( location.Key, location.DisplayTextResolved );

                    //  Assign the appropriate image to the location/node
                    location.Settings.Appearance.Image = this.GetImage(drive.DriveType);
                    node.Override.NodeAppearance.Image = this.GetImage(drive.DriveType);

                    //  Assign an instance of a wrapper class which associates the node,
                    //  location and directory to each object to the Tag property.
                    node.Tag = new DirectoryWrapper( drive.RootDirectory, location );
                    location.Tag = new DirectoryWrapper( drive.RootDirectory, node );
                }
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
    }
Requirements

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

See Also