Cloud Training (Online)

How to Display Directions via Built-in Maps in Windows Phone 8 App?

The Windows Phone 8 SDK provides the MapsDirectionsTask launcher which allows the users to get the route or direction from the built-in maps application in windows phone 8.

To get the route, simply create an instance of the MapsDirectionsTask, set the Start and End co-ordinates and call the Show method. If the Start property is not set, the phone takes the current location as the starting point.

How to Display Directions via Built-in Maps in Windows Phone 8 App?












FontFamily="{StaticResource PhoneFontFamilyNormal}"

FontSize="{StaticResource PhoneFontSizeNormal}"

Foreground="{StaticResource PhoneForegroundBrush}"

SupportedOrientations="Portrait" Orientation="Portrait"


<Grid x:Name="LayoutRoot" Background="Transparent">


<RowDefinition Height="Auto" />

<RowDefinition Height="*" />


<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">

<TextBlock Text="@ISENTHIL" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0" />

<TextBlock Text="MOBILEOSGEEK" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="48" />


<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

<Button x:Name="MapsBtn" Content="Get Direction" HorizontalAlignment="Left" Height="133" Margin="27,68,0,0" VerticalAlignment="Top" Width="419" Click="MapsBtn_Click" />




C#(Code Behind)

using Microsoft.Phone.Controls;

using Microsoft.Phone.Maps;

using Microsoft.Phone.Shell;

using Microsoft.Phone.Tasks;

using MobileOSGeekMaps.Resources;

using System;

using System.Collections.Generic;

using System.Device.Location;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Navigation;

namespace MobileOSGeekMaps


public partial class MainPage : PhoneApplicationPage


// Constructor

public MainPage()




private void Map1_Loaded(object sender, RoutedEventArgs e)



private void MapsBtn_Click(object sender, RoutedEventArgs e)


MapsDirectionsTask direction = new MapsDirectionsTask();

direction.End = new LabeledMapLocation("End", new GeoCoordinate(13.0022, 077.5980));





How to Display Directions via Built-in Maps in Windows Phone 8 App?

How to Display Directions via Built-in Maps in Windows Phone 8 App?

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.