Map.Center Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the location of the center of the Map.

Namespace:  Microsoft.Phone.Maps.Controls
Assembly:  Microsoft.Phone.Maps (in Microsoft.Phone.Maps.dll)


<TypeConverterAttribute(GetType(GeoCoordinateConverter))> _
Public Property Center As GeoCoordinate
public GeoCoordinate Center { get; set; }

Property Value

Type: System.Device.Location..::.GeoCoordinate
The location of the center of the Map.


Don’t use the Latitude property and the Longitude property to set the center of the Map. Instead, create a new GeoCoordinate object and assign it to the Center property.

If you try to change the center by providing a new GeoCoordinate that is less than two centimeters (2 cm.) from the current center, the change is ignored.

After you set the value of the TransformCenter property for the Map, the Center property continues to return the previous center until you set the Center to the same value as the TransformCenter.

During initialization of the Map control, the CenterChanged event is raised one time after the initialization. If your app handles the CenterChanged event, make sure that you handle this event correctly when it’s raised after initialization of the control.

The following code example shows how you can set the center of Map by using XAML.

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
   <maps:Map x:Name="MyMap" Center="47.6097, -122.3331" />

The following code example shows how can set the center of Map by using code.

// Constructor
public MainPage()

   Map MyMap = new Map();
   MyMap.Center = new GeoCoordinate(47.6097, -122.3331);

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also


Map Class

Microsoft.Phone.Maps.Controls Namespace

Other Resources

Maps and navigation for Windows Phone 8