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
680
Sorting Locations
posted

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

private void BuildLocations(UltraNavigationBarLocation locate, DataRow dr)

{

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);

}

 

}

}

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    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.

Children