Image In Tooltip In WPF


In this article we will see how we can Bind an Image to the Tooltip of an Image.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as ImageTooltipInWPF.

Here is the basic idea about the sample application; we will have a list of images and it would display it’s Image (Larger than Thumbnail) in it’s Tooltip on the top as it’s preview.

So let’s have a ListBox and then we will bind the images onto it.

The above Class represents the Movie Structure.

We would have an ItemPanelTemplate and ListBoxItemTemplate to view the images in the ListBox.

Now run the application to see the images loaded in the ListBox.

Now our ImageToolTip should display on top of each image, for that to happen I have designed a Border that would contain an Image and it would be bound to Source of Parent Image.

Include the above inside Image that is defined in the ListBoxItem Style.

Now we are ready to see our Image in Tooltip.

Run the application and mouse hover on any of the Images in the List.

Hope this article helps.