Presenting Flat Lists

Presenting a list of nongrouped items is done by setting the LongListSelector’s IsGroupingEnabled property to false, which is the default value. When presenting a flat list, there is little difference between a LongListSelector and a regular ListBox control, apart from the added header and footer of the LongListSelector.

To demonstrate how to display a flat list in a LongListSelector, we populate a LongListSelector with a list of custom City objects.

The FlatListViewModel in the downloadable sample code exposes a list of cities (see Listing 10.1).

LISTING 10.1. FlatListViewModel Class

public class FlatListViewModel : ViewModelBase{    readonly IEnumerable<City> cities = new List<City>        { ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.