Can you sort locations in the UltraWinNavigationBar? I am using it to build a menu system and wanted specific location objects to be at listed at the bottom of the list of locations. I have noticed that whatever order they are added in the get sorted by name in the drop down. Also does the tool allow auto complete text when typing in the control?
I have provided the recursion method that builds the locations
{
DataRow[ childs;foreach (DataRelation drel in dr.Table.ChildRelations ) { childs = dr.GetChildRows(drel);for (int i = 0; i < childs.GetLength(0); i++) { DataRow child = childs[i];UltraNavigationBarLocation newLocation = locate.Locations.Add(child[MENU_ID].ToString(), child[MENU_NAME].ToString()); newLocation.Settings.Appearance.Image = imageList1.Images[MENU_FOLDER_ICO];if (child[MENU_ID].ToString().StartsWith("REP_")) { newLocation.Settings.Appearance.Image = imageList1.Images[MENU_REPORT_ICO];newLocation.Tag = Convert.ToBoolean(child[MENU_CRYSTAL]); } BuildLocations(newLocation, child); } }
DataRow[ childs;
childs = dr.GetChildRows(drel);for (int i = 0; i < childs.GetLength(0); i++) { DataRow child = childs[i];UltraNavigationBarLocation newLocation = locate.Locations.Add(child[MENU_ID].ToString(), child[MENU_NAME].ToString()); newLocation.Settings.Appearance.Image = imageList1.Images[MENU_FOLDER_ICO];if (child[MENU_ID].ToString().StartsWith("REP_")) { newLocation.Settings.Appearance.Image = imageList1.Images[MENU_REPORT_ICO];newLocation.Tag = Convert.ToBoolean(child[MENU_CRYSTAL]); } BuildLocations(newLocation, child);
childs = dr.GetChildRows(drel);
DataRow child = childs[i];UltraNavigationBarLocation newLocation = locate.Locations.Add(child[MENU_ID].ToString(), child[MENU_NAME].ToString()); newLocation.Settings.Appearance.Image = imageList1.Images[MENU_FOLDER_ICO];if (child[MENU_ID].ToString().StartsWith("REP_")) { newLocation.Settings.Appearance.Image = imageList1.Images[MENU_REPORT_ICO];newLocation.Tag = Convert.ToBoolean(child[MENU_CRYSTAL]); } BuildLocations(newLocation, child);
newLocation.Settings.Appearance.Image = imageList1.Images[MENU_FOLDER_ICO];
newLocation.Settings.Appearance.Image = imageList1.Images[MENU_REPORT_ICO];newLocation.Tag = Convert.ToBoolean(child[MENU_CRYSTAL]);
newLocation.Settings.Appearance.Image = imageList1.Images[MENU_REPORT_ICO];
}
BuildLocations(newLocation, child);
Thank you. I found that sample yesterday after I created the post. Sorry. I did create a feature request for the auto complete. Thank you again for your feed back.
By default, the locations are sorted in ascending alphabetical order, as they are in the Windows Vista navigation bar. The recommended way to change the sort order is to handle the 'LocationExpanding' event, and sort the VisibleMembers collection of the parent location's Locations collection.
Example:private void ultraNavigationBar1_LocationExpanding(object sender, LocationExpandingEventArgs e){ e.Location.Locations.VisibleMembers.Sort( new MySortComparer() );}
Regarding auto-complete; no, the control does not support that behavior; if you like you can submit a feature request for that functionality.