I am trying to use LongListSelector in conjunction with CollectionView. CollectionView seems to have everything you need, but when I connect the two, nothing happens. Here is what I still have:
In my ctor control (the guy who contains LLS), I create a CollectionView:
GroupDescription group = new PropertyGroupDescription("FullName", new FirstLetterConverter(true, true)); m_view.GroupDescriptions.Add(group);
Then, whenever the corresponding dependency property (the one that contains the list that I want to add to LLS) changes, I send and assign this m_view and assign the ItemsSource groups:
private void FriendsChanged() { m_view.Source = Friends; friendList.ItemsSource = m_view.View.Groups;
When I check the .Groups property, the information seems kosher - it has the correct number of elements, and each element has children that seem to be correct. However, everything seems to be internal, and therefore LLS does not seem to be able to display the relevant information. When I replace CollectionView with a mock collection, LLS shows the information (so I'm sure LLS is configured correctly)
Here's what I use with LLS - note that instead of binding, I use "XXXX" in several places to make sure that nothing breaks like this due to incorrect binding:
<toolkit:LongListSelector x:Name="friendList"> <toolkit:LongListSelector.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Source="{Binding ThumbnailImage}" Width="62" Height="62"/> <TextBlock Text="{Binding FullName}"/> </Grid> </DataTemplate> </toolkit:LongListSelector.ItemTemplate> <toolkit:LongListSelector.GroupHeaderTemplate> <DataTemplate> <Border Background="{StaticResource PhoneAccentBrush}" Padding="{StaticResource PhoneTouchTargetOverhang}" Width="200" HorizontalAlignment="Left"> <TextBlock Text="XXXX" Style="{StaticResource PhoneTextLargeStyle}"/> </Border> </DataTemplate> </toolkit:LongListSelector.GroupHeaderTemplate> <toolkit:LongListSelector.GroupItemTemplate> <DataTemplate> <Border Background="{StaticResource PhoneAccentBrush}" Margin="{StaticResource PhoneTouchTargetOverhang}" Padding="{StaticResource PhoneTouchTargetOverhang}" Width="180"> <TextBlock Text="XXXX" Style="{StaticResource PhoneTextLargeStyle}"/> </Border> </DataTemplate> </toolkit:LongListSelector.GroupItemTemplate> </toolkit:LongListSelector>
source share