Click here to Skip to main content
15,880,651 members
Articles / Mobile Apps / Windows Phone 7

Developing a Windows Phone 7 Jump List Control

Rate me:
Please Sign up or sign in to vote.
4.95/5 (29 votes)
18 May 2011CPOL18 min read 96.1K   2.2K   46  
This article describes the development of a Windows Phone 7 Jump List control, giving a step-by-step account of the control's development (and a pretty flashy control to use at the end of it!).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;

namespace JumpListControl
{
  /// <summary>
  /// A category provider that categorizes items based on the first character of the
  /// property named via the PropertyName property.
  /// </summary>
  public class AlphabetCategoryProvider : ICategoryProvider
  {
    /// <summary>
    /// Gets or sets the name of the property that is used to assign each item
    /// to a category.
    /// </summary>
    public string PropertyName { get; set;}

    public object GetCategoryForItem(object item)
    {
      var propInfo = item.GetType().GetProperty(PropertyName);
      object propertyValue = propInfo.GetValue(item, null);
      return ((string)propertyValue).Substring(0, 1).ToUpper();
    }

    public List<object> GetCategoryList(IEnumerable items)
    {
      return Enumerable.Range(0, 26)
              .Select(index => Convert.ToChar((Convert.ToInt32('A') + index)).ToString())
              .Cast<object>()
              .ToList();
    }
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Scott Logic
United Kingdom United Kingdom
I am CTO at ShinobiControls, a team of iOS developers who are carefully crafting iOS charts, grids and controls for making your applications awesome.

I am a Technical Architect for Visiblox which have developed the world's fastest WPF / Silverlight and WP7 charts.

I am also a Technical Evangelist at Scott Logic, a provider of bespoke financial software and consultancy for the retail and investment banking, stockbroking, asset management and hedge fund communities.

Visit my blog - Colin Eberhardt's Adventures in .NET.

Follow me on Twitter - @ColinEberhardt

-

Comments and Discussions