We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Execute Command on click of Marker Tooltip Label

Thread ID:





147632 Sep 18,2019 05:55 AM UTC Sep 19,2019 06:28 AM UTC Xamarin.Forms 3
Tags: SfMaps
Anukriti Shukla
Asked On September 18, 2019 05:55 AM UTC

I have added Custom Markers in the Imagery Layer & added the Tooltip to display Text on Marker Click.
Is there an event that fires on click of this tooltip Text?

My requirement is to show tooltip text on click of marker and on clicking that text I want to get the selected marker and execute a command. Is that possible?

Vignesh Ramesh [Syncfusion]
Replied On September 18, 2019 02:47 PM UTC

Hi Anukriti, 

Greetings from Syncfusion. 

We have achieved your requirement in Android platform by adding Label in the Marker’s TooltipTemplate and added TapGestureRecognizer, Command and CommandParameter for the Label.  

For other platforms, we have some issue in our source level. So, the TapGesture not get recognized in sample level. So, if you confirm the provided solution fulfills your requirement, then we will log bug report on this and provide you a patch otherwise, if your requirement is different from the above. Please provide more details on your requirement. This would be helpful for us to give better solution in this. 

Please find the code snippet below 

<maps:SfMaps x:Name="Map" 
            <DataTemplate x:Key="template"> 
                <Label Text="{Binding Label}" BackgroundColor="White" > 
                        <TapGestureRecognizer Command="{Binding BindingContext.TapCommand, Source={x:Reference Map}}" 
                                              CommandParameter="{Binding Converter={StaticResource TestConverter}}"/> 
                        <maps:TooltipSetting x:Name="tooltipSettings" ShowTooltip="True" ValuePath="Label" TextColor="White" 
                                             Margin="10" BackgroundColor="Navy" 
                                             StrokeColor="Black" StrokeWidth="2" TooltipTemplate="{StaticResource template}"> 

public partial class MainPage : ContentPage 
    public MainPage() 
        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. 

Please find the sample from the below link 

Anukriti Shukla
Replied On September 19, 2019 06:24 AM UTC

Thank you so much, its working perfectly fine. 

Rachel A [Syncfusion]
Replied On September 19, 2019 06:28 AM UTC

Hi Anukriti, 
Thanks for the update. 
Please let us know if you have any other queries. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon