Reputation: 418
I am following this article to create a event to command behaviour on Google maps. Here is my xaml
<maps:Map x:Name="map" HeightRequest="200"
ItemsSource="{Binding FutsalPins}" >
<maps:Map.Behaviors>
<behaviors:EventToCommandBehavior EventName="MapClicked" Command="{Binding MapClickedCommand}" />
</maps:Map.Behaviors>
<maps:Map.ItemTemplate>
<DataTemplate>
<maps:Pin Position="{Binding Position}"
Address="{Binding Address}"
Label="{Binding Description}" >
<maps:Pin.Behaviors>
<behaviors:EventToCommandBehavior EventName="Clicked" Command="{Binding PinClickedCommand}" />
</maps:Pin.Behaviors>
</maps:Pin>
</DataTemplate>
</maps:Map.ItemTemplate>
</maps:Map>
the maps:Map.Behaviours is working as expected. However for
maps:Pin.Behaviors
I get an an error saying
Error Position 31:34. No property, bindable property, or event found for 'Behaviors', or mismatching type between value and property.
Error XLS0415 The attachable property 'Behaviors' was not found in type 'Pin'.
Upvotes: 0
Views: 455
Reputation: 14956
Error Position 31:34. No property, bindable property, or event found for 'Behaviors', or mismatching type between value and property.
Error XLS0415 The attachable property 'Behaviors' was not found in type 'Pin'.
As the Pin class doesn't have the Behaviors
property.
The Pin class defines a MarkerClicked
event, which is fired when a Pin is tapped and it also defines a InfoWindowClicked
event that's fired when an information window is tapped.You could see here.
And you also could try Clicked
event directly.
<maps:Pin Position="{Binding Position}" Clicked="Pin_Clicked
Address="{Binding Address}"
Label="{Binding Description}" >
</maps:Pin>
Upvotes: 1