ToolTip pushpin

2 posts, 0 answers
  1. Massimiliano
    Massimiliano avatar
    3 posts
    Member since:
    May 2009

    Posted 14 Jul 2011 Link to this post

    Hi all,
    I have two questions:

    I have in a WPF form a RadMap control.
    1) The only way I know to see the pushpin tooltip is moving the mouse over it.
    If in a map I added 10 pushpin is it possible to see simultaneally all the tooltip after the map is loaded?

    2) Is it possible to open a new form clicking on the tooltip?

    var pin = new Pushpin { Background = new SolidColorBrush(colore) };
    var tip = new ToolTip { Content = tool };
    ToolTipService.SetToolTip(pin, tip);
    var loc = new Location { Latitude = lat, Longitude = lon };
    MapLayer.SetLocation(pin, loc);

    Thanks in advance...

  2. Andrey
    Andrey avatar
    1681 posts

    Posted 19 Jul 2011 Link to this post

    Hello Massimiliano,

    Indeed you can show all tooltips automatically using the ToolTip.PlacementTarget, ToolTip.Placement and ToolTip.IsOpen properties. However we suggest that you are not using this approach as if you drag the map then the tooltips will not move together with its pushpin. Also you can't click inside the tooltip for opening another form.

    I would recommend that you are using the template of the pushpin as a base for the item template of the information layer. You can add the content presenter element and then bind the "tooltip" to its Content property. You can bind a collection of your items to the information layer.
    The sample code is below.
    <Window x:Class="WpfTooltip.MainWindow"
            Title="MainWindow" Height="350" Width="525">
            <LinearGradientBrush x:Key="MapPushpinStroke" EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="White"/>
                <GradientStop Color="Black" Offset="0.853"/>
                Center="41, -74"
                    <telerik:OpenStreetMapProvider />
                <telerik:InformationLayer Name="informationLayer">
                            <Border telerik:MapLayer.Location="{Binding Location}">
                                    <telerik:HotSpot X="0.5" Y="40" XUnits="Fraction" YUnits="InsetPixels" ElementName="path" />
                                    <Path x:Name="path" Stretch="None"
                                  Stroke="{StaticResource MapPushpinStroke}"
                                  Data="M12,26.083 L16,26.083 13.916667,32.083 z M14,3 C20.075132,3 25,7.9248676 25,14 25,20.075132 20.075132,25 14,25 7.9248677,25 3,20.075132 3,14 3,7.9248676 7.9248677,3 14,3 z"
                                  Fill="{Binding Background}">
                                        <DropShadowEffect xmlns=""
                                            BlurRadius="7" ShadowDepth="1" />
                                    <ContentPresenter Margin="15,40,0,0" Content="{Binding Content}" />

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Media;
    using Telerik.Windows.Controls.Map;
    namespace WpfTooltip
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            ObservableCollection<MapItem> items = new ObservableCollection<MapItem>();
            public MainWindow()
                this.radMap.InitializeCompleted += new EventHandler(radMap_InitializeCompleted);
            private void radMap_InitializeCompleted(object sender, EventArgs e)
                Brush foreground = new SolidColorBrush(Colors.Yellow);
                Brush background = new SolidColorBrush(Colors.Brown);
                TextBlock text = new TextBlock()
                    Text = "Content 1",
                    Background = background,
                    Foreground = foreground
                this.items.Add(new MapItem(41, -73, background, text));
                background = new SolidColorBrush(Colors.Blue);
                text = new TextBlock()
                    Text = "Content 2",
                    Background = background,
                    Foreground = foreground
                this.items.Add(new MapItem(41, -74, new SolidColorBrush(Colors.Blue), text));
                this.informationLayer.ItemsSource = items;

    using System.Windows.Media;
    using Telerik.Windows.Controls.Map;
    namespace WpfTooltip
        public class MapItem
            public object Content
            public Location Location
            public Brush Background
            public MapItem(double lat, double lon, Brush background, object content)
                this.Location = new Location(lat, lon);
                this.Background = background;
                this.Content = content;

    Best wishes,
    Andrey Murzov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top