Menu

3 different groups, 3 different lists

Help
2015-10-31
2015-11-29
  • Donald Smith

    Donald Smith - 2015-10-31

    Hi!

    I've recently upgraded my project to use ObjectListView and it's been amazing... but I cannot figure out how to do the following:

    Is it possible to add a List of objects to a group? I have 3 different List<T> lists I want to add to the listview, each under their own group.

    For instance see my code below:

    // Get the 3 lists
    List<SCIXAccount> scixNames = usearch.FindAccounts(SCIXSearchType.Name, txtSearch.Text.ToUpper());
    List<SCIXAccount> scixInitials = usearch.FindAccounts(SCIXSearchType.Initials, txtSearch.Text.ToUpper());
    List<SCIXAccount> scixSalesID = usearch.FindAccounts(SCIXSearchType.SalesID, txtSearch.Text.ToUpper());

    After that I'd like to have 3 groups in the ObjectListView (Name, Initals, and SalesID) and then do something like this:

    lvSCIX.Groups["name"].Items.Add(scixNames)
    lvSCIX.Groups["Initials"].Items.Add(scixInitials)
    lvSCIX.Groups["salesID"].Items.Add(scixSalesID)

    And each group would contain every item from that list.

    Here is how I did I did it with a normal listview, but I can't seem to figure it out with an ObjectListView:

    ListViewItem lvItem = lvSTORISSearch.Items.Add(p.Name);

    lvItem.SubItems.Add(p.Initals);
    lvItem.SubItems.Add(p.SalesID);
    lvItem.SubItems.Add(p.Type);
    lvItem.Group = lvSTORISSearch.Groups["name"];

     

Log in to post a comment.