Question

I was just experimenting with the same example application which Corinna Black demonstrated in this Video (around ~21:40). She created sample data in Blend and bound it to the Grid of the Panorama Item as an ListBox. This is the only option Blend will provide me when I dragndrop the collection to the Designer.

Starting with Windows Phone 8, the ListBox was replaced by the LongListSelector of the Windows Phone Toolkit. My question is now: How is it possible, that Blend can use the ListBox while I'm not able to use the ListBox in Visual Studio 2012 although I have created a Windows Phone 8 only project? If I try to replace ListBox with LongListSelector in the XAML code, Blend will complain with this error:

The name "LongListSelector" does not exist in the namespace "http://schemas.microsoft.com/client/2007"

I thought that the usage of ListBox is deprecated because of better scrolling performance in LongListSelector. So why is Blend using the older ListBox instead of the supposed better LongListSelector? And how can I use the sample data creation with LongListSelector for Windows Phone 8 apps?

Thank you!

Was it helpful?

Solution

I've found the answer to my problem: The LongListSelector is not part of the normal libraries. It is part of the Windows Phone Toolkit library, which must be added beforehand with NuGet.

Add to your xaml the new namespace:

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

Now you can access the LongListSelector with

<phone:LongListSelector/>

You can then assign an ItemsSource and can work with it even from blend with design data.

OTHER TIPS

The longlistselector is now part of the core SDK libraries. I would recommend using it instead of the toolkit's LLS.

The core lib LLS is made to replace seamlessly your WP7 listbox, you will have to make some customization if you want to use the toolkit's one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top