…
<maps:SfMaps x:Name="Map"
MinZoom="11"
EnableZooming="true"
ZoomLevel="10"
MaxZoom="13">
<maps:SfMaps.Resources>
<ResourceDictionary>
<DataTemplate x:Key="template">
<Label Text="{Binding Label}" BackgroundColor="White" >
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding BindingContext.TapCommand, Source={x:Reference Map}}"
CommandParameter="{Binding Converter={StaticResource TestConverter}}"/>
</Label.GestureRecognizers>
</Label>
</DataTemplate>
</ResourceDictionary>
</maps:SfMaps.Resources>
<maps:SfMaps.Layers>
…
<maps:MapMarkerSetting.TooltipSettings>
<maps:TooltipSetting x:Name="tooltipSettings" ShowTooltip="True" ValuePath="Label" TextColor="White"
Margin="10" BackgroundColor="Navy"
StrokeColor="Black" StrokeWidth="2" TooltipTemplate="{StaticResource template}">
</maps:TooltipSetting>
</maps:MapMarkerSetting.TooltipSettings>
</maps:MapMarkerSetting>
</maps:ImageryLayer.MarkerSettings>
</maps:ImageryLayer>
</maps:SfMaps.Layers>
</maps:SfMaps>
… |
…
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
this.BindingContext = new ColorMappingsViewModel();
}
}
…
public class ColorMappingsViewModel
{
public ImageSource ImageName { get; set; }
public Command<CustomMarker> TapCommand { get; protected set; }
public ColorMappingsViewModel()
{
ImageName = ImageSource.FromResource("mapssample.Icons.grid.png");
TapCommand = new Command<CustomMarker>(OnTapped);
}
private void OnTapped(CustomMarker selectedMarker)
{
// Your action here.
}
}
… |