I recently had a requirement where I want to show a tooltip for pushpin and this is with Bing Maps for Silverlight. I have worked with Bing Map AJAX control, and it has this thing called Infobox which is found on Microsoft.Maps.Infobox namespace. But unfortunately in Bing Maps Silverlight control, you can’t find any Infoboxes or tooltips. But that doesn't mean, you can’t add tooltips for your pushpins in Silverlight. For that we can use, ToolTipService Class in System.Windows.Controls namespace and let’s see this in action.
Now in my Silverlight application I have several pushpins loaded into my map. First what I would do is extend the Pushpin class, so I can add some properties into it. In my tooltip I am planning to have a title field, a description field and a image. So I am adding following properties to my extended Pushpin class.
Now I should use this properties in my tooltip. For that I am going to create a new tooltip style and I will use that particular style for my tooltips.
Application.Resources in App.xaml
Now I have to set the tooltips for my pushpins using ToolTipService.SetToolTip(…).
Now when I run the project, I am getting the following output.