Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links


Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories


Post Categories

.NET Framework


Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

Windows Phone: picking up contacts in code

In Windows Phone apps, you can easily pick up contacts from the contact list in code. You simply need to use a chooser called Microsoft.Phone.Tasks.AddressChooserTask.

You define an instance:

    Private contattoSelezionato As String
    Dim WithEvents addressChooser As AddressChooserTask
    Public Sub New()
        Me.addressChooser = New AddressChooserTask
     End Sub

Then you invoke Show to start the chooser:


To determine the returned contact, you handle the Completed event and you read the value only if the user has confirmed her choice (the TaskResult.OK value from the TaskResult enum):

    Private Sub addressChooser_Completed(sender As Object, e As AddressResultHandles addressChooser.Completed
        If e.TaskResult = TaskResult.OK Then
            Me.contattoSelezionato = e.DisplayName
        End If
    End Sub

Other than the DisplayName you can also retrieve the Address , which is actually the value that determines the difference between contacts with the same name or between elements belonging to the same contact.


Print | posted on giovedì 14 marzo 2013 11:25 | Filed Under [ Silverlight/Windows Phone ]


No comments posted yet.

Post Comment

Please add 3 and 1 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET