Windows Phone (Mango) Contact Chooser Task

When creating the amazing, incredible and life changing app for managing money you borrow and lend Metrowe I was pretty annoyed to discover that in the Mango SDK there are choosers for selecting emails: EmailAddressChooserTask and phone numbers: PhoneNumberChooserTask but not just plain selecting a contact. The problem with the other choosers is the email address will exclude contacts without an email and similarly the phone number chooser and phone numbers. After much complaining decided to develop my own contact chooser (quite closely based off this french one) matching the OS version as closely as possible. This is what it ended up looking like:


Seamless huh? I’ve managed to get the calling code for this down to something nice a simple which pretty much matches the built in choosers:

private void button1_Click(object sender, RoutedEventArgs e)
    var contactChooser = new ContactChooserTask();
    contactChooser.OnSelected += new EventHandler<ContactChooserEventArgs>(contactChooser_OnSelected);

void contactChooser_OnSelected(object sender, ContactChooserEventArgs e)

Under the covers it is a bit of a different story. The display relies on the Silverlight Toolkit’s LongListSelector (which is awesome) and uses code pretty similar to that described by my good friend Benjii in his post: How to Use the Long List Selector for Windows Phone Mango. The code to encapsulate the page is kind of a mish mash of code adapted(/stolen) from the source of the Coding4Fun toolkit (also awesome). That said it seems to work well in my app and in my very limited testing.

The code for the library lives on github at lukencode/ContactChooser and is free and open source fork it, try it out, tell me how I suck then submit a pull request fixing the aforementioned suck! A couple of things that would be cool to see added would be some nice transition animations in and out and some more control over how the chooser looks.

👋 Are you an 🇦🇺 Australian developer or IT professional? Go check out my site Australian Technology Jobs - a Premium developer and IT job board and find awesome Australian dev jobs (and people).
Questions or comments? Follow me on twitter!
Follow @lukencode