Why can't I just use GroupBy for grouped LongListSelector ItemsSource

53 Views Asked by At

There is a popular example for making a LongListSelector with groups. However this seems overly complex and I don't understand why just using GroupBy doesn't work. Given:

    List<string> l = new List<string>();
    l.Add("alan");
    l.Add("albert");
    l.Add("bert");
    l.Add("bill");

The following gives me a list as expected:

    LongListSelector1.ItemsSource = l;

However after enabling grouping on the list the following just shows me the group headers:

    LongListSelector1.ItemsSource = l.GroupBy(s => s.Substring(0, 1)).ToList();

I don't understand why. The LongListSelector has access to the Key and the elements of the group apparently in the same way that it does in the example linked above.

0

There are 0 best solutions below