Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1210
URGENT!!! error on ultraNavigationBar
posted

this.ultraNavigationBar1.RootLocation.Text = @"C:\CMT\";

 

or:

this.ultraNavigationBar1.RootLocation.Text = @"C:\CMT";

gives me this error:

An UltraNavigationBarLocation cannot contain the PathSeparator in any part of the text which is used to identify it when parsing a navigation path.

How do I specify a starting folder?

 

Parents
  • 1210
    posted

    I solved my question above with:

    ultraNavigationBar1.NavigateTo("C:\\CMT", true);

    My question now is how do I prevent the user from going to the parent of the root I navigate to. IE... I want to just let them navigate within a certain root folder or it's sub folders.

  • 53790
    posted in reply to ross

    Please download this sample: UltraNavigatorBarPresetLocation.zip 

    Here ia the code:

    public partial class Form1 : Form

        {

            public Form1()

            {

                InitializeComponent();

                ultraNavigationBar1.InitializeLocations += new Infragistics.Win.Misc.UltraWinNavigationBar.InitializeLocationsHandler(ultraNavigationBar1_InitializeLocations);

            }

     

            void ultraNavigationBar1_InitializeLocations(object sender, Infragistics.Win.Misc.UltraWinNavigationBar.InitializeLocationsEventArgs e)

            {

                DirectoryInfo[] dirs = new DirectoryInfo(e.ParentLocation.Key + "\\").GetDirectories();

                foreach (DirectoryInfo dir in dirs)

                {

                    e.ParentLocation.Locations.Add(dir.FullName, dir.Name);

                }

            }

     

     

            private void Form1_Load(object sender, EventArgs e)

            {

                DirectoryInfo[] dirs = new DirectoryInfo("C:\\").GetDirectories();

                foreach (DirectoryInfo dir in dirs)

                {

                    ultraNavigationBar1.RootLocation.Locations.Add(dir.FullName, dir.Name);

                }

                ultraNavigationBar1.NavigateTo("Program Files\\Microsoft Visual Studio 10.0\\Common7", true);

            }

        }

    Let me know if you have any questions.

  • 1210
    posted in reply to Georgi

    My issue is not in the navigation bar but in the tvwFolders UltraTree in the "Infragistics FileExplorer CS.zip" sample. I have the navigation bar in this defaulting but since the UltaTree logic starts with Desktop and My Computer I need the code to change this to start with something like "C:\Downloads".

           

    private void PopulateRoot()

            {

               

    // Add Desktop Node to the tree

               

    UltraTreeNode desktopNode = this.tvwFolders.Nodes.Add("Desktop", "Desktop");

                desktopNode.Override.NodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

                desktopNode.Override.ExpandedNodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

     

               

    // Set up the root location of the navigation bar as the Desktop location

               

    UltraNavigationBarLocation desktopLocation = this.unbFolders.RootLocation;

                desktopLocation.Key =

    "Desktop";

                desktopLocation.Settings.Appearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

               

    // Don't include the text of the Desktop location in the full path of it's children.

               

    // This is so that children of the Desktop and My Computer locations have the correct path

               

    // like Windows Explorer. For example, "C:\Program Files" is a complete path.

               

    // It should not be "Desktop\My Computer\C:\Program Files"

                desktopLocation.IncludeTextInFullPath =

    false;

               

    // The tree will be the central driving force of this application, so give the location a

               

    // reference to the corresponding node in the tree.

               

                desktopLocation.Tag = desktopNode;

     

               

    // Add the My Computer node to the tree

               

    UltraTreeNode myComputerNode = desktopNode.Nodes.Add("MyComputer", "My Computer");

                myComputerNode.Override.NodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

                myComputerNode.Override.ExpandedNodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

               

    // Add the My Computer location to the navigation bar.

               

    UltraNavigationBarLocation myComputerLocation = desktopLocation.Locations.Add("MyComputer", "My Computer");

                myComputerLocation.Settings.Appearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

               

    // Don't include the text of the My Computer location in the full path of it's children.

               

    // This is so that children of the Desktop and My Computer locations have the correct path

               

    // like Windows // Explorer. For example, "C:\Program Files" is a complete path.

               

    // It should not be "Desktop\My Computer\C:\Program Files"

                myComputerLocation.IncludeTextInFullPath =

    false;

               

    // The tree will be the central driving force of this application, so give the location a

               

    // reference to the corresponding node in the tree.

                myComputerLocation.Tag = myComputerNode;

     

               

    // Assign the folder/open folder icons for all generic folders

               

    this.tvwFolders.Override.NodeAppearance.Image = this.IconManager.GetBitmap(IconName.FolderSmall);

               

    this.tvwFolders.Override.ExpandedNodeAppearance.Image = this.IconManager.GetBitmap(IconName.FolderOpenSmall);

               

    // Assign the folder icons for all generic folders

               

    this.unbFolders.LocationSettings.Appearance.Image = this.IconManager.GetBitmap(IconName.FolderSmall);

               

    // Expand and select the Desktop node           

                desktopNode.Expanded =

    true;

                desktopNode.Selected =

    true;

            }

  • 53790
    posted in reply to ross

    Hello Ross,

    rookertrusted said:

    My issue is not in the navigation bar but in the tvwFolders UltraTree in the "Infragistics FileExplorer CS.zip" sample. I have the navigation bar in this defaulting but since the UltaTree logic starts with Desktop and My Computer I need the code to change this to start with something like "C:\Downloads".

    I`m not sure that I understand what is your issue. At the begining we are talking about UltraNavigationBar and how to set initial path. I do not understand what is your issue with UltraTree and what exactly doesn`t work in the "Infragistics FileExplorer CS.zip" sample.

    Let me know if you have any questions.

    Regards

Reply
  • 1210
    posted in reply to Georgi

    PLEASE, I beg you. YOUR SAMPLE Infragistics FileExplorer CS.zip" has this section of code in it. How do I set it to NOT USE "DESKTOP" or "MYCOMPUTER" but rather "C:\DOWNLOADS". PLEASE, PLEASE, PLEASE look at YOUR SAMPLE. This uses a a Navigation bar but the code below in YOUR SAMPLE also displays a beautiful tree to the left that in NOT A NAVIGATIONBAR. HELP, HELP, HELP

     

     

    private void PopulateRoot()

            {

              

    // Add Desktop Node to the tree

              

    UltraTreeNode desktopNode = this.tvwFolders.Nodes.Add("Desktop", "Desktop");

                desktopNode.Override.NodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

                desktopNode.Override.ExpandedNodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

     

              

    // Set up the root location of the navigation bar as the Desktop location

              

    UltraNavigationBarLocation desktopLocation = this.unbFolders.RootLocation;

                desktopLocation.Key =

    "Desktop";

                desktopLocation.Settings.Appearance.Image =

    this.IconManager.GetBitmap(IconName.Desktop);

              

    // Don't include the text of the Desktop location in the full path of it's children.

              

    // This is so that children of the Desktop and My Computer locations have the correct path

              

    // like Windows Explorer. For example, "C:\Program Files" is a complete path.

              

    // It should not be "Desktop\My Computer\C:\Program Files"

                desktopLocation.IncludeTextInFullPath =

    false;

              

    // The tree will be the central driving force of this application, so give the location a

              

    // reference to the corresponding node in the tree.

              

                desktopLocation.Tag = desktopNode;

     

              

    // Add the My Computer node to the tree

              

    UltraTreeNode myComputerNode = desktopNode.Nodes.Add("MyComputer", "My Computer");

                myComputerNode.Override.NodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

                myComputerNode.Override.ExpandedNodeAppearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

              

    // Add the My Computer location to the navigation bar.

              

    UltraNavigationBarLocation myComputerLocation = desktopLocation.Locations.Add("MyComputer", "My Computer");

                myComputerLocation.Settings.Appearance.Image =

    this.IconManager.GetBitmap(IconName.MyComputer);

              

    // Don't include the text of the My Computer location in the full path of it's children.

              

    // This is so that children of the Desktop and My Computer locations have the correct path

              

    // like Windows // Explorer. For example, "C:\Program Files" is a complete path.

              

    // It should not be "Desktop\My Computer\C:\Program Files"

                myComputerLocation.IncludeTextInFullPath =

    false;

              

    // The tree will be the central driving force of this application, so give the location a

              

    // reference to the corresponding node in the tree.

                myComputerLocation.Tag = myComputerNode;

     

              

    // Assign the folder/open folder icons for all generic folders

              

    this.tvwFolders.Override.NodeAppearance.Image = this.IconManager.GetBitmap(IconName.FolderSmall);

              

    this.tvwFolders.Override.ExpandedNodeAppearance.Image = this.IconManager.GetBitmap(IconName.FolderOpenSmall);

              

    // Assign the folder icons for all generic folders

              

    this.unbFolders.LocationSettings.Appearance.Image = this.IconManager.GetBitmap(IconName.FolderSmall);

              

    // Expand and select the Desktop node           

                desktopNode.Expanded =

    true;

                desktopNode.Selected =

    true;

            }

Children