O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating tooltips

Tooltips are typically those yellowish (or another color, depending on the Windows theme and user customization) pop ups that show up when the mouse pointer hovers over something important within the UI, providing some extra information relevant to that something. WPF makes it easy to create tooltips, either standard ones, or custom.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

  1. Create a new WPF application named CH04.ToolTips.
  2. Open MainWindow.xaml. Add two rows to the existing Grid as follows:
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition />
    </Grid.RowDefinitions>
    
  3. Add a ToolBar to the Grid, with two buttons in it:
    <ToolBar> <Button Content="Copy" FontSize="16" Margin="4" Padding="4" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required