How can you go about setting a location like E:\TEMP\FOLDER1 as the root location of the WinNavigationBar, so that you cannot see anything below the heirarchy of E:\TEMP\FOLDER1? I just can't get past a parsing error, and I've not found a working example. Thank you!!!
Hello,
I am glad to hear that you were able to solve your issue.
Thank you for using Infragistics components.
Hi Hristo,
Got past my tiny issue THANK YOU!!! I needed to sense the RootLocation in the SelectedLocationChanged event to manage choosing the root path in the UltraNavigationBar:
private void ultraNavigationBar1_SelectedLocationChanged(object sender, Infragistics.Win.Misc.UltraWinNavigationBar.SelectedLocationChangedEventArgs e) { this.LoadFilesAndFolders(e.SelectedLocation.Equals(ultraNavigationBar1.RootLocation) ? rootLokation : e.SelectedLocation.Key); }
Also very tiny change, I needed to add a class variable, a boolean named bLoaded so I can suppress firing the InitializeLocations events during loading. See the use of bLoaded in the following two functions. These are the only changes I made to your example.
private void Form1_Load(object sender, EventArgs e)
{ bLoaded = false; DirectoryInfo[] dirs = new DirectoryInfo(rootLokation).GetDirectories(); foreach (DirectoryInfo dir in dirs) { ultraNavigationBar1.RootLocation.Locations.Add(dir.FullName, dir.Name); }
bLoaded = true; }
private void ultraNavigationBar1_InitializeLocations(object sender, Infragistics.Win.Misc.UltraWinNavigationBar.InitializeLocationsEventArgs e) { if (!bLoaded) return;
// Populate an array of DirectoryInfos with the // subdirectories of the parent location's path. DirectoryInfo[] dirs = new DirectoryInfo((e.ParentLocation.Equals(ultraNavigationBar1.RootLocation) ? rootLokation:e.ParentLocation.Key) + "\\").GetDirectories(); // Loop through each subdirectory...
foreach (DirectoryInfo dir in dirs) { // ...add a new location to WinNavigationBar. // The subdirectory's full path will be the key // and the name will be the Text. e.ParentLocation.Locations.Add(dir.FullName, dir.Name); } }
This is great!!! Answers 99% for me. But run it and from the UltraNavigationBar browse out to a few folders, and then user the ultranavigationbar to select the root site. It displays C:\ instead of L:\DATA. (In the worst way, that control wants to go to a root drive.)
Thank you!!!
Sincerely,
James
I’ve implemented a simple sample in order to demonstrate you how you could achieve your goal. In my case for root location I’ve used “L:\\Data”, so you may need to change this.
I hope that this will helps you.