MapsTask.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 that will be used as the center point for the map.

Namespace:  Microsoft.Phone.Tasks
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.

Syntax

Public Property Center As GeoCoordinate
public GeoCoordinate Center { get; set; }
<object>
  <object.Center>
    <GeoCoordinate .../>
  </object.Center>
</object>

Property Value

Type: System.Device.Location..::.GeoCoordinate
Type: GeoCoordinate. The center point of the map.

Remarks

If you do not set the Center property before calling Show()()(), the user’s current location is used. You must set either the Center property or the SearchTerm property before calling Show or an InvalidOperationException will be thrown.

The GeoCoordinate type is found in the System.Device.Location namespace. To use it, you should add a reference to System.Device.dll to your application project and include the following using directive in your code.

using System.Device.Location;

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

MapsTask Class

Microsoft.Phone.Tasks Namespace

Other Resources

Launchers and Choosers for Windows Phone 8

How to use the Maps task for Windows Phone 8