Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147632 | Sep 18,2019 05:55 AM UTC | Sep 19,2019 06:28 AM UTC | Xamarin.Forms | 3 |
![]() |
Tags: SfMaps |
…
<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.
}
}
… |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.