地理定位不适用于桌面模拟器(uwp)



你好,我正试图在通用Windows平台中创建一个包含地图的视图我做了一件事:

             using System;
             using System.Collections.Generic;
             using System.IO;
             using System.Linq;
             using System.Runtime.InteropServices.WindowsRuntime;
             using Windows.Foundation;
             using Windows.Foundation.Collections;
             using Windows.UI.Xaml;
             using Windows.UI.Xaml.Controls;
             using Windows.UI.Xaml.Controls.Primitives;
             using Windows.UI.Xaml.Data;
            using Windows.UI.Xaml.Input;
            using Windows.UI.Xaml.Media;
            using Windows.UI.Xaml.Navigation;
            using Windows.Devices.Geolocation;

     namespace Project
         {
          /// <summary>
     /// An empty page that can be used on its own or navigated to within a                     Frame.
/// </summary>
public sealed partial class Geolocation : Page
{
    public Geolocation()
    {
        this.InitializeComponent();
    }
    public async void GetCords()
    {
        Geolocator locator = new Geolocator();
        Geoposition pos = await locator.GetGeopositionAsync();
        await new Windows.UI.Popups.MessageDialog(pos.CivicAddress.City).ShowAsync();
       }
    }
 }

但是我有一张空白页!我在这里错过了什么?

如果您想在页面中添加MapControl,您必须:

  1. 为地图创建关键点
  2. xmlns:maps="using:Windows.UI.Xaml.Controls.Maps <maps:MapControl
  3. <maps:MapControl x:Name="map" MapServiceToken="YOUR_TOKEN_HERE" />

最新更新