Tooltip for PolylineData PolygonData

3 posts, 0 answers
  1. Randall Anderson
    Randall Anderson avatar
    5 posts
    Member since:
    Dec 2009

    Posted 24 Mar 2015 Link to this post

    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. Randall Anderson
    Randall Anderson avatar
    5 posts
    Member since:
    Dec 2009

    Posted 24 Mar 2015 Link to this post

    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.
  3. DevCraft banner
  4. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 27 Mar 2015 Link to this post

    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.

     
Back to Top