【发布时间】:2021-01-29 14:02:12
【问题描述】:
为什么我的本地:CustomMap 错误 对不起,我是英语初学者, https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/map-pin 我的项目名称 PTSSRU
xaml code
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="PTSSRU.Views.MapPage"
xmlns:local="clr-namespace:PTSSRU;assembly=PTSSRU"
<local:CustomMap x:Name="customMap"
MapType="Street" />
</ContentPage>
cs code
using PTSSRU.Custom;
using System.Collections.Generic;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace PTSSRU.Views
{
public partial class MapPage : ContentPage
{
public MapPage()
{
InitializeComponent();
CustomPin pin = new CustomPin
{
Type = PinType.Place,
Position = new Position(37.79752, -122.40183),
Label = "Xamarin San Francisco Office",
Address = "394 Pacific Ave, San Francisco CA",
Name = "Xamarin",
Url = "http://xamarin.com/about/"
};
customMap.CustomPins = new List<CustomPin> { pin };
customMap.Pins.Add(pin);
customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(37.79752, -122.40183),
Distance.FromMiles(1.0)));
}
}
}
【问题讨论】:
-
错误是什么?是编译错误还是运行时异常?请提供具体错误或异常消息
-
你好,你可以分享一下项目结构的截图,然后我会检查
CustomMap的路径。
标签: xamarin.forms