1. Daniel Affleck's Avatar
    This has been driving me nuts - missing something simple i know - but dont want to waste any more time if possible. have a long list on my page with its data source set thus:

    [CODE] var result = (from s in App.ViewModel.AllSampleData
    join j in App.ViewModel.AllJobData
    on s.SampleJobID equals j.JobID
    select new { j.JobNumber, s.SampleNumber }).GroupBy(j => j.JobNumber).ToList();

    this.lstSamples.ItemsSource = result;[/CODE]

    the markup is as follows:

    [CODE] <phone:LongListSelector
    x:Name="lstJobSamplesGrouped"
    IsGroupingEnabled="True"
    GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}"
    ItemTemplate="{StaticResource SampleTemplate}"
    LayoutMode="List"
    HorizontalAlignment="Left" Margin="10,10,0,10"
    Width="436" Tap="lstSamples_Tap"/>[/CODE]

    and the templates thus:

    [CODE]<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="GroupHeaderTemplate">
    <StackPanel VerticalAlignment="Top">
    <TextBlock FontWeight="Bold" FontSize="26" Text="{Binding Key}" />
    </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="SampleTemplate">
    <StackPanel VerticalAlignment="Top">
    <TextBlock FontWeight="Bold" FontSize="26" Text="{Binding SampleNumber}" />
    </StackPanel>
    </DataTemplate>
    </phone:PhoneApplicationPage.Resources>[/CODE]

    the key displays fine, but the grouped items are not showing:

    should show something like this -

    A2000
    001
    002
    003
    A2001
    001
    002

    but I get just

    A2000
    A2001
    A2002

    perhaps someone could shed some light on this for me

    many thanks :)
    04-11-2014 06:44 AM
  2. Laura Knotek's Avatar
    Hi Daniel and welcome to WPCentral.

    I've moved your thread to the Developers Corner forum, since this is something that developers will be better able to help you with than regular users.
    04-11-2014 11:31 PM
  3. Catholic Tech Geek's Avatar
    Ok, for LongListSelector, what you need depends on which os you are developing for. Unless you tell me differently, I am assuming you are developing a program for Windows Phone 8. First, you need to have the IsGroupingEnabled property set to true. LongListSelector in Windows Phone 8 requires 3 parts: ItemTemplate, GroupHeaderTemplate, and JumpListStyle. ItemTemplate is for each item in a group. GroupHeaderTemplate is for each group "header". JumpListStyle is a style, not a DataTemplate (like the other 2). JumpListStyle is what is shown when the user wants to select a group to scroll to. It is made up of 3 parts: LayoutMode, which is either grid or list, ItemTemplate, and (if you chose grid for the JumpListStyle) GridCellSize.

    Looking at your code above, I find no issue with your C# code behind. However, in your XAML, you are missing the JumpListStyle property. If you are unsure of anything, check out the documentation for LongListSelector on MSDN.
    04-12-2014 11:19 PM
  4. Catholic Tech Geek's Avatar
    Ok, for LongListSelector, what you need depends on which os you are developing for. Unless you tell me differently, I am assuming you are developing a program for Windows Phone 8. First, you need to have the IsGroupingEnabled property set to true. LongListSelector in Windows Phone 8 requires 3 parts: ItemTemplate, GroupHeaderTemplate, and JumpListStyle. ItemTemplate is for each item in a group. GroupHeaderTemplate is for each group "header". JumpListStyle is a style, not a DataTemplate (like the other 2). JumpListStyle is what is shown when the user wants to select a group to scroll to. It is made up of 3 parts: LayoutMode, which is either grid or list, ItemTemplate, and (if you chose grid for the JumpListStyle) GridCellSize.

    Looking at your code above, I find no issue with your C# code behind. However, in your XAML, you are missing the JumpListStyle property. If you are unsure of anything, check out the documentation for LongListSelector on MSDN.
    04-12-2014 11:19 PM

Similar Threads

  1. Bing wallpaper does not change to the photo of the day...
    By dsmpampis in forum Nokia Lumia 920
    Replies: 12
    Last Post: 02-17-2015, 12:38 PM
  2. Replies: 2
    Last Post: 05-28-2014, 05:46 PM
  3. Replies: 0
    Last Post: 04-10-2014, 04:30 PM
LINK TO POST COPIED TO CLIPBOARD