0
votes

why my local:CustomMap Error sorry i'm beginner in english, https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/map-pin my project name 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)));
            }
        }
    }
1
What is the error? Is it a compile error or a runtime exception? Please provide the specific error or exception messageJason
Hi, you could share the screenshot of project's structure, then I will check the path of CustomMap.Junior Jiang

1 Answers

0
votes
I have finished the map

But I want to change the pin icon.
Error Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 7, position 5. PTSSRU C:\Users\MrC4\source\repos\PTSSRU\PTSSRU\PTSSRU\Views\MapPage.xaml 7
incode
<local:CustomMap x:Name="customMap"
MapType="Street" />
im not sure xmlns:local="clr-namespace:PTSSRU;assembly=PTSSRU" it Correct.
my git hub
https://github.com/s58122519013/Xamarin.Map.git