Metro Nuggets

Bitesized tidbits for building Modern (Metro) apps.

ListBox to LongListSelector in Windows Phone 8

If you’re moving a project from Windows Phone 7 to Windows Phone 8 and you use ListBoxes in your app, you can keep them in there with no real problems. However, it’s not recommended to keep using them, instead use the LongListSelector instead. If you’re familiar with the LongListSelector from the Windows Phone Toolkit, then you’ll find the new native LongListSelector a very different beast and you probably wouldn’t think to use it because you know what it was previously only really used for. Previously you would only really use the LongListSelector if you were after a people hub or application list style grouping, but the new native version has been tweaked and improved upon and had massive performance enhancements. You can also just use it as a straight, flat ListBox, complete with all the performance enhancements it brings.

Making the change from ListBox to LongListSelector is actually very simple, just change your xaml to use the LongListSelector instead of the ListBox. It’s as simple as that. When you then run your app, it will already be a flat ListBox as you were before, but with those mentioned performance enhancements.


            <ListBox x:Name="LLS">
                        <TextBlock Text="{Binding}"
                                   Style="{StaticResource PhoneTextLargeStyle}" />


            <phone:LongListSelector x:Name="LLS">
                        <TextBlock Text="{Binding}"
                                   Style="{StaticResource PhoneTextLargeStyle}" />

It’s as simple as that.

Stay tuned for more on the new LongListSelector.


5 responses to “ListBox to LongListSelector in Windows Phone 8

  1. Pingback: ListBox to LongListSelector in Windows Phone 8

  2. S0me0ne December 2, 2012 at 14:13

    I my app, i had set the “IsFlatList” property to “True”. Otherwise, no items have been displayed.

  3. Henry Chong December 29, 2012 at 18:05

    Hi Scott,

    How would you reimplement Selected Item states with the LongListSelector? The selected states that come with ListBox don’t seem to be available, and the SelectedItem property only provides the databound object, not my custom user control that I could ask the VisualStateManager to manually switch this in for me

    Searching through the internet doesn’t seem to come up with anythign either, and the LongListSelector sample on the dev site also omits selected item states. any tips?


  4. VzLOM February 20, 2013 at 16:13

    Same question here – how to implement SelectedItem Style? I even implemented bindable SelectedItems and possibility to bind to Commands… but failed w styles.

  5. ponsel terbaru March 5, 2013 at 16:47

    thank for tips.. windows 7 very usefull

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: