This is a migrated thread and some comments may be shown as answers.

Tooltip for PolylineData PolygonData

2 Answers 75 Views
Map
This is a migrated thread and some comments may be shown as answers.
Randall Anderson
Top achievements
Rank 1
Randall Anderson asked on 24 Mar 2015, 04:29 PM
Since switching to VisualizationLayer tooltips had to be changed and are now no longer working.

ToolTipService.SetToolTip cant be used because it requires a dependency object.

PolygonData/PolylineData both have a ToolTipFormat (string) property but no matter what I set it to, all it displays is a small rectangle (hardly visible) with no content.

I would rather not use ToolTipTemplate.  

I create these types manually and need to set the tooltip based on data retrieved from server.  How do I go about doing this?

gkelly

2 Answers, 1 is accepted

Sort by
0
Randall Anderson
Top achievements
Rank 1
answered on 24 Mar 2015, 06:28 PM
decided to use MapShapeVisualizationCreated on the VisualizationLayer.  I don't like doing it this way, but it works.
In the event there is a FrameworkElement you can set a tooltip on.
0
Martin Ivanov
Telerik team
answered on 27 Mar 2015, 12:36 PM
Hi Randall,

The ToolTipFormat property can be used only to get data from the ExtendedData property of the object that represent the map's shape. If there is no extended data you won't be able to any tooltip. You can read more on how to set the ToolTipFormat property in the Reading Map Shapes help article.

In order to display a property from the shape objects you can re-template the tooltip by using the ToolTipStyle property. Here is an example style:
<Style TargetType="ToolTip" x:Key="toolTipStyle">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ToolTip">
                <TextBlock Text="{Binding Location}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
The approach with the visualization created event that you are using is also a possible way to go for achieve your requirement.

Regards,
Martin
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Map
Asked by
Randall Anderson
Top achievements
Rank 1
Answers by
Randall Anderson
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or