In this article I will show you how to get an address from a contact and display it. Expected Output
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using Microsoft.Phone.Controls;using Microsoft.Phone.Tasks ; namespace AddressChooser{ public partial class MainPage : PhoneApplicationPage { // Constructor AddressChooserTask addressChooserTask; public MainPage() { InitializeComponent(); addressChooserTask = new AddressChooserTask(); addressChooserTask.Completed += new EventHandler<AddressResult>(addressChooserTask_Completed); } private void addressChooserButton_Click(object sender, RoutedEventArgs e) { try { addressChooserTask.Show(); } catch (System.InvalidOperationException ex) { } } void addressChooserTask_Completed(object sender, AddressResult e) { if (e.TaskResult == TaskResult.OK) { txtDisplay.Text = "The address for " + e.DisplayName + " is " + e.Address; } } }}Now when you run the phone application you should get the expected output. I hope this article was useful. Thanks for reading.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: