How to use tooltip on marker using markers itemsource on shape file layer

Hello all,

I have a sf map, using shapefile layer.

I have a simple collection of markers bound to it as MarkerItemsSource and with a MarkerDataTemplate defined. 

 MarkerItemsSource="{Binding CustomMarkers}" 

What I want to achieve is to apply tool tip binding based on a value of the bound marker. 

I tried in xaml and they don't show. I tried to add it from code behind but it does not show.

var settings = new MapMarkerSetting();
settings.TooltipSettings.ShowTooltip = true;
settings.TooltipSettings.ValuePath = "Label";
settings.TooltipSettings.TextColor = Color.White;
settings.TooltipSettings.BackgroundColor = Color.Blue;
ShapeLayer.MarkerSettings = settings;

Thanks.


3 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team August 25, 2020 03:29 PM UTC

Hi Rjuken Developments,

We have checked the reported query SfMap control tooltip support, and it is working fine in our side. Please  have a sample from below.

Sample link: https://www.syncfusion.com/downloads/support/forum/157242/ze/MapSample1129921698 

Code snippet:

 
         <maps:ShapeFileLayer Uri="world1.shp" ItemsSource="{Binding Models}"  MarkerItemsSource="{Binding Models}"> 
                <maps:ShapeFileLayer.ShapeSettings> 
                    <maps:ShapeSetting ShapeFill="Gray" /> 
                </maps:ShapeFileLayer.ShapeSettings> 
             <maps:ShapeFileLayer.MarkerSettings> 
                    <maps:MapMarkerSetting> 
                        <maps:MapMarkerSetting.TooltipSettings> 
                            <maps:TooltipSetting ShowTooltip="True" ValuePath="Label" TextColor="Black" BackgroundColor="Red"/> 
                        </maps:MapMarkerSetting.TooltipSettings> 
                    </maps:MapMarkerSetting> 
                </maps:ShapeFileLayer.MarkerSettings> 
                <maps:ShapeFileLayer.MarkerTemplate> 
                    <DataTemplate> 
                        <StackLayout IsClippedToBounds="false" HorizontalOptions="StartAndExpand" VerticalOptions="Center" HeightRequest="30"> 
                            <Image Source="pin.png" Scale="1" Aspect="AspectFit " HorizontalOptions="StartAndExpand" VerticalOptions="Center"  HeightRequest="15" WidthRequest="23" /> 
                        </StackLayout> 
                    </DataTemplate> 
                </maps:ShapeFileLayer.MarkerTemplate> 
            </maps:ShapeFileLayer> 
        </maps:SfMaps.Layers> 

Please check with the sample and if the issue still persists please modify the same with the issue reproducing, which will be helpful for us to analyse further and provide an appropriate solution. 
 
Regards, 
Sridevi S. 
 


Marked as answer

RD Rjuken Developments August 26, 2020 04:03 PM UTC

Hello Syncfusion Team,

I tried your sample with the same things I have on my side, except the template, and indeed it works.

So I found out what was the issue. I'm using a Lottie animation as MarkerTemplate, and seems like the lottie control takes more space than expected, so I had to set the InputTransparent property to true in order to the tooltip to work. 

Thanks ! 


RS Ramya Soundar Rajan Syncfusion Team August 27, 2020 07:34 AM UTC

Hi Rjuken Developments, 
 
We are glad that you have resolved the problem. 
 
Please get in touch with us if you would require any further assistance. 
 
Regards, 
Ramya S 


Loader.
Up arrow icon