1. Dustin Hodges's Avatar
    I'm currently trying to build a longlistselector that displays the users music albums using the XNA framework in a Windows Phone 8.1 Silverlight app. My problem is, whenever i enable grouping, if i scroll too fast through the list, the software will throw:
    [CODE]A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll
    Additional information: [Line: 0 Position: 0][/CODE]
    To which i cant debug since the symbol file (System.Windows.pdb) is missing (and looking around suggests its missing on purpose since you can't debug the system).

    This is a problem, since i need grouping enabled, but for some reason it's causing this exception. Anyone have any ideas?
    05-01-2014 06:14 PM
  2. Catholic Tech Geek's Avatar
    Please post the xml markup so that I can get a better picture. Also, how are you creating the groups for the LongListSelector?
    05-02-2014 10:45 PM
  3. Dustin Hodges's Avatar
    Library Page Resources:
    [CODE]<phone:PhoneApplicationPage.Resources>
    <phone:JumpListItemBackgroundConverter x:Key="BackgroundConverter"/>
    <phone:JumpListItemForegroundConverter x:Key="ForegroundConverter"/>
    <Style x:Key="JumpListStyle" TargetType="phone:LongListSelector">
    <Setter Property="GridCellSize" Value="113,113"/>
    <Setter Property="LayoutMode" Value="Grid" />
    <Setter Property="ItemTemplate">
    <Setter.Value>
    <DataTemplate>
    <Border Background="{Binding Converter={StaticResource BackgroundConverter}}" Width="113" Height="113" Margin="6" >
    <TextBlock Text="{Binding Key}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="48" Padding="6" Foreground="{Binding Converter={StaticResource ForegroundConverter}}" VerticalAlignment="Center"/>
    </Border>
    </DataTemplate>
    </Setter.Value>
    </Setter>

    </Style>

    <DataTemplate x:Key="AlbumItem">
    <StackPanel Orientation="Horizontal" MaxWidth="460" MaxHeight="113" Margin="20,0,0,10">
    <Border Height="113" Width="113" Child="{Binding albumImage}" />
    <StackPanel Orientation="Vertical" Margin="10,0,0,0">
    <TextBlock Text="{Binding albumName}" Foreground="White" FontSize="36" FontFamily="Segoe WP Black" TextTrimming="WordEllipsis"/>
    <TextBlock Text="{Binding albumArtist}" Opacity="0.65" Foreground="White" FontFamily="Segoe WP Black" FontSize="24" TextTrimming="WordEllipsis"/>
    </StackPanel>
    </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="GroupHeader">
    <Border Background="Transparent" Padding="0,10,5,5" Margin="20,0,0,0">
    <Grid Background="{StaticResource PhoneAccentBrush}" Width="62" Height="62" Margin="0,0,18,0" HorizontalAlignment="Left">
    <TextBlock Text="{Binding Key}" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="48" Padding="6" FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </DataTemplate>
    </phone:PhoneApplicationPage.Resources>[/CODE]

    List and it's enclosing panoramic pivot:
    [CODE]<phone:PivotItem Header="albums" x:Name="albumViewer">
    <Grid>
    <phone:LongListSelector x:Name="albList" ItemTemplate="{StaticResource AlbumItem}" JumpListStyle="{StaticResource JumpListStyle}" GroupHeaderTemplate="{StaticResource GroupHeader}" HideEmptyGroups="True" IsGroupingEnabled="True" />
    </Grid>
    </phone:PivotItem>[/CODE]

    Library CS file:
    [CODE]using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using Windows.Storage;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using System.Threading;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using Microsoft.Xna.Framework.Input;
    using Microsoft.Xna.Framework.Media;
    using System.Windows.Resources;
    using System.Windows.Media.Imaging;
    using [redacted];
    using System.Threading.Tasks;
    using System.Windows.Media;

    namespace [redacted]
    {
    public partial class Library : PhoneApplicationPage
    {
    public Library()
    {
    InitializeComponent();
    }

    protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
    base.OnNavigatedTo(e);

    // Get Albums
    MediaLibrary Library = new MediaLibrary();
    List<AlbumList> source = new List<AlbumList>();
    AlbumCollection Albums = Library.Albums;

    foreach (Album album in Albums)
    {
    Image thumbnail = new Image();
    BitmapImage thumb = new BitmapImage();
    System.IO.Stream thumbnailStream = album.GetThumbnail();
    if (thumbnailStream != null)
    {
    thumb.SetSource(thumbnailStream);
    }
    else
    {
    thumb.UriSource = new Uri("/Assets/media/album.png", UriKind.Relative);
    }

    thumb.DecodePixelHeight = 113;
    thumb.DecodePixelWidth = 113;
    thumb.DecodePixelType = DecodePixelType.Logical;
    thumb.CreateOptions = BitmapCreateOptions.BackgroundCreation;
    thumb.CreateOptions = BitmapCreateOptions.DelayCreation;

    thumbnail.Source = thumb;
    thumbnail.Width = 113;
    thumbnail.Height = 113;
    thumbnail.Stretch = System.Windows.Media.Stretch.UniformToFill;

    source.Add(new AlbumList(thumbnail, album.Name.ToUpper(), album.Artist.Name.ToUpper()));

    }

    List<AlphaKeyGroup<AlbumList>> DataSource = AlphaKeyGroup<AlbumList>.CreateGroups(source, System.Threading.Thread.CurrentThread.CurrentUICulture, (AlbumList s) => { return s.albumName; }, true);
    albList.ItemsSource = DataSource;
    }

    }

    public class AlbumList
    {
    public string albumName { get; set; }
    public string albumArtist { get; set; }
    public Image albumImage { get; set; }

    public AlbumList(Image albumimage, string albumname, string albumartist)
    {
    this.albumName = albumname;
    this.albumArtist = albumartist;
    this.albumImage = albumimage;
    }
    }
    }[/CODE]

    And my alphaKeyGroup for grouping is borrowed from the Microsoft how-to: How to display data in a grouped list in LongListSelector for Windows Phone 8

    (FYI: I'm not using any xml.)
    05-02-2014 11:26 PM

Similar Threads

  1. 2 new Yezz Windows Phones
    By Studio384 in forum Upcoming & Rumored Phones
    Replies: 13
    Last Post: 09-01-2014, 12:40 PM
  2. Replies: 4
    Last Post: 05-02-2014, 12:06 PM
  3. CDI College buys in. Orders over 5,800 Surface 2s.
    By HeyCori in forum Microsoft Surface 2
    Replies: 1
    Last Post: 05-01-2014, 07:42 PM
  4. Danal opens up mobile operator billing for Windows Phone Store
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 05-01-2014, 05:11 PM
  5. India's online marketplace, Tradus updates Windows Phone app for better experience
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 05-01-2014, 05:00 PM
LINK TO POST COPIED TO CLIPBOARD