Is there a way to override the alphabetical display order for the NavigationBar? I would like it to list locations in the order that I have added them, but it always sorts them alphabetically.
Thanks, Gerry
It's aboslutely imperative I have the same functionality too.
It doesn't sort it by key, that's for sure, it's sorting by the text, this is fine, but when you press the history button in the NavigationToolbar, it shows the text not the DisplayText, obviously a bug. I put counters at the start so it would sort because the Sort method on both Visible Members and locations doesn't work. I set it to SortOrder.None, didn't work. So counters at the start of the text, which still isn't good enough, the history list shows rootlocation\1item, rootlocation\2item etc...
Any help please, this is paramount to our application, also, have you noticed when you press the drop down to see the locations in the root location and you move your mouse up and down the "child" locations, the highlighting of the item get slower and slower and slower......
I finally decided to use the Tag property on Navigation Bar locations to hold the value that I wish to sort by.
I created a Comparer class as follows:
public class LocationTagComparer : System.Collections.Generic.IComparer<UltraNavigationBarLocation> { int IComparer<UltraNavigationBarLocation>.Compare(UltraNavigationBarLocation first, UltraNavigationBarLocation second) { if (first == null & second == null) { return 0; } else if (first == null) { return -1; } else if (second == null) { return 1; } else { return first.Settings.Tag.ToString().CompareTo(second.Settings.Tag.ToString()); } } }
After building the location list, use a comparer object to do the sorting: this.ultraNavigationBar1.RootLocation.Locations.VisibleMembers.Sort(new LocationTagComparer());
Add code to the Location Expanding event.
private void ultraNavigationBar1_LocationExpanding(object sender, Infragistics.Win.Misc.UltraWinNavigationBar.LocationExpandingEventArgs e) { if (e.Location.Level == -1) { e.Location.Locations.VisibleMembers.Sort(new LocationTagComparer()); } }Hope this helps.