Home Forums WinForms controls Other WinForms controls Grouping in Wincombobox dropdown

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18293 |

    I have a combo box with a data source which is a database table with many columns. I would like to group the drop-down rows by one of these columns, as can be done in the Grid control. The user needs to be able to expand/contract the groups. I gather the drop-down in a WinCombobox is actually a grid, so how do I go about this? Can I set it up at design time, or does it have to be done in the code?

    Imported from legacy forums. Posted by Steve (had 2781 views)

    User (Old forums)
    Member
    Post count: 23064

    Actually, I have found a way by chipping away at it myself. I did the following in the Load event on the form containing the combo:

    grp = New Xceed.Grid.Group(“Group”)
    grpm = grp.HeaderRows(0)
    grpm.TitleFormat = “%GroupTitle% – %DataRowCount% Set(s)”
    grp.Collapse() ‘ not required, but how I wanted it to start off
    combo.DropDownControl.GroupTemplates.Add(grp)

    This seems to work OK. The combo’s dropdown shows the group headers only, and each can be expanded/collapsed as required. Is it the “right” way to do this?

    Imported from legacy forums. Posted by Steve (had 239 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes, it sure is!

    Imported from legacy forums. Posted by André (had 3771 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.