将 pin 添加到 MapControl 时无法隐式转换类型

Cannot implicitly convert type when adding pin to MapControl

我正在尝试向 MapControl 动态添加图钉,但尽管使用了导入语句 (using),但它无法正常工作。 new Point(0.5, 1)NormalizedAnchorPoint = new Point(0.5, 1)returns下面的错误。解决这个问题的正确方法是什么?

Cannot implicitly convert type 'Windows.Foundation.Point' to 'System.Drawing.Point'

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using TownTraveller.Data;
using TownTraveller.UserControls;
using Windows.Devices.Geolocation;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

    public MainPage()
    {
        this.InitializeComponent();

        var mapPage = new MapPage();

        var pinUri = new Uri("ms-appx:///Images/MapPin.png");

        var myMapControl = pageMap.MyMapControl;

        var mapCenter =
           new Geopoint(new BasicGeoposition()
           {
               Latitude = 51053881,
               Longitude = -0.100239
           });
        myMapControl.Center = mapCenter;

        myMapControl.ZoomLevel = 10;

        var MapPoints = new List<PointOfInterest>();
        var mapPin1 = new PointOfInterest
        {
            PinName = "Pin1",
            DisplayName = "Place One",
            ImageSourceUri = pinUri,
            ),
            Location = new Geopoint(new BasicGeoposition()
            {
                Latitude = 51.486223,
                Longitude = -0.124474
            })

        };

        MapPoints.Add(mapPin1);
    }
}

'PointOfInterest' class

public class PointOfInterest
{
    public string PinName { get; set; }
    public string DisplayName { get; set; }
    public Uri ImageSourceUri { get; set; }
    public Point NormalizedAnchorPoint { get; set; }
    public Geopoint Location { get; set; }
}

Cannot implicitly convert type 'Windows.Foundation.Point' to 'System.Drawing.Point'

问题是 NormalizedAnchorPoint 属性 正在使用 System.Drawing 命名空间。您可以将 NormalizedAnchorPoint 的完整命名空间 Windows.Foundation.Point 添加到特定类型,如下所示。

public class PointOfInterest
{
    public string PinName { get; set; }
    public string DisplayName { get; set; }
    public Uri ImageSourceUri { get; set; }
    public Windows.Foundation.Point NormalizedAnchorPoint { get; set; }
    public Geopoint Location { get; set; }
}