DataTemplateSelector not working with ImageryLayer.MapMarkerSetting.TooltipSettings.TooltipTemplate

Hi,

I'm trying to use the DataTemplateSelector on my Map Marker Tooltip and the OnSelectTemplate method is not called.

I have the following error message: System.InvalidOperationException: 'LoadTemplate should not be null'

XAML:

    <ContentPage.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="SrcTooltipTemplate">
               ...
            </DataTemplate>

            <DataTemplate x:Key="DstTooltipTemplate">
              ...
            </DataTemplate>

            <local:TooltipDataTemplateSelector
                x:Key="MarkerTooltipDataTemplateSelector"
                SourceTooltipTemplate="{StaticResource SrcTooltipTemplate}"
                DestinationTooltipTemplate="{StaticResource DstTooltipTemplate}" />
        </ResourceDictionary>
    </ContentPage.Resources>

    <ContentPage.Content>
<maps:SfMaps
                            IsVisible="True"
                            ZoomLevel="{Binding MapZoom}">
                            <maps:SfMaps.Layers>
                                <maps:ImageryLayer
                                    BingMapKey="xxxxxxxxxxxxx"
                                    BingMapStyle="Road"
                                    GeoCoordinateChanged="Map_GeoCoordinateChanged"
                                    GeoCoordinates="{Binding GeoCoordinates}"
                                    LayerType="Bing"
                                    MarkerTemplate="{StaticResource markerTemplate}"
                                    Markers="{Binding MyMarkers}">

                                    <maps:ImageryLayer.MarkerSettings>
                                        <maps:MapMarkerSetting>
                                            <maps:MapMarkerSetting.TooltipSettings>
                                                <maps:TooltipSetting
                                                    PointerLength="16"
                                                    ShowTooltip="True"
                                                    TooltipTemplate="{StaticResource MarkerTooltipDataTemplateSelector}"
                                                    ValuePath="Label"
                                                    Duration="10000" />
                                            </maps:MapMarkerSetting.TooltipSettings>
                                        </maps:MapMarkerSetting>
                                    </maps:ImageryLayer.MarkerSettings>
                                </maps:ImageryLayer>
                            </maps:SfMaps.Layers>
                        </maps:SfMaps>
    </ContentPage.Content>

Template Selector CLASS:

    public class TooltipDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate SourceTooltipTemplate { get; set; }

        public DataTemplate DestinationTooltipTemplate { get; set; }

        protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
        {
            var marker = item as CustomMarker;

            switch (marker.MarkerType)
            {
                case Shared.MapPositionEnum.Start:
                    return SourceTooltipTemplate;

                case Shared.MapPositionEnum.Destination:
                    return DestinationTooltipTemplate;
            }
        }
    }


3 Replies 1 reply marked as answer

RS Ramya Soundar Rajan Syncfusion Team August 24, 2020 02:34 PM UTC

Hi Tito, 
 
On further analysis with your updated query and the provided stack trace, currently we don’t have DataTemplateSelector support for the marker’s tooltip. We will check the feasibility to consider as a feature request and update you the status on August 25, 2020. 
 
Regards, 
Ramya S 



RS Ramya Soundar Rajan Syncfusion Team August 25, 2020 02:25 PM UTC

Hi Tito,  
 
We have considered the reported problem as feature enhancement and please find the feedback task below here. 
  
 
We will include this feature in our upcoming Volume 3 release which is expected to be rolled out on end of September 2020. 
 
Regards, 
Ramya S 



RS Ramya Soundar Rajan Syncfusion Team October 6, 2020 01:21 PM UTC

Hi Tito, 
 
We are glad to announce that our Essential Studio 2020 Volume 3 release v18.3.0.35 is rolled out and is available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Ramya S 


Marked as answer
Loader.
Up arrow icon