ASH-1598 avatar image
0 Votes"
ASH-1598 asked YonglunLiu-MSFT commented

error in Xamarin.Forms Map Pins


help me I'm having an error in the code,

The error:

Property 'DataTemplateContent' does not support values of type 'Pin'.
line 4

the Code:

             <publicViews:MapItemTemplateSelector x:Key="MapItemTemplateSelector">
                             Address="{Binding Description}"
                             Icon="{Binding IconNumber, Converter={StaticResource iconConverter}}"
                             IsVisible="{Binding Isvisible}"
                             Label="{Binding Address}"
                             Position="{Binding Position}"

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is this code in ContentPage.Resources? Referring to the official sample, we can find the following notice in PinItemsSourcePage.xaml:

<maps:Map x:Name="map"
         ItemsSource="{Binding Locations}"
<!-- Alternatively, set ItemTemplateSelector to MapItemTemplateSelector -->

You could add ItemTemplateSelector="{StaticResource MapItemTemplateSelector} in maps:Map to implement the function.

And you can refer to this documentation Creating a Xamarin.Forms DataTemplateSelector to get more details about how to create DataTemplateSelector.

0 Votes 0 ·

May I know whether your issue has been solved or not? If not, please share it in here. We can work together to figure it out.

0 Votes 0 ·

0 Answers