Version

Settings Property (UltraNavigationBarLocation)

Returns an UltraNavigationBarLocationSettings instance which exposes properties for this UltraNavigationBarLocation.
Syntax
'Declaration
 
Public ReadOnly Property Settings As UltraNavigationBarLocationSettings
public UltraNavigationBarLocationSettings Settings {get;}
Remarks

The LocationSettings property is of the same type as the Settings property; setting a sub-property of the control's LocationSettings property affects all locations that do not have a more specific setting for that property. For example, the UltraNavigationBarLocationSettings.MaximumDropDownItems property could be set to ten so that only ten locations appear in the dropdown for all locations. The same property could be set to 20 on the instance returned by the Settings property of the RootLocation, so that all locations except the root show ten while the root shows 20.

The properties which are exposed by the UltraNavigationBarLocationSettings class are those that one might typically set for more than one instance. This is why properties such as Text, DisplayText, etc. are exposed by the UltraNavigationBarLocation class and not by the UltraNavigationBarLocationSettings class.

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