Complex ToolTip

image_pdfimage_print


   
      
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  Title="About WPF" 
  Background="OrangeRed">
        <Canvas>
        <CheckBox>
          CheckBox
          <CheckBox.ToolTip>
            <StackPanel>
              <Label FontWeight="Bold" Background="Blue" Foreground="White">
                The CheckBox
              </Label>
              <TextBlock Padding="10" TextWrapping="WrapWithOverflow" Width="200">
                this is a test
              </TextBlock>
              <Line Stroke="Black" StrokeThickness="1" X2="200"/>
              <StackPanel Orientation="Horizontal">
                <Image Margin="2" Source="help.png"/>
                <Label FontWeight="Bold">Press F1 for more help.</Label>
              </StackPanel>
            </StackPanel>
          </CheckBox.ToolTip>
        </CheckBox>
        </Canvas>

</Window>

   
    
    
    
    
    
     


Control the Display Duration and Position of a Tool Tip

image_pdfimage_print


   
     

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="200" Width="300">
    <StackPanel>
        <Button Height="40" Margin="5" ToolTipService.Placement="Mouse" 
                ToolTipService.ShowDuration="1000">
            <Button.ToolTip>
                <ToolTip>
                    ToolTip displayed for 1 second...
                </ToolTip>
            </Button.ToolTip>
            Button with ToolTip under Mouse
        </Button>
    </StackPanel>
</Window>

   
    
    
    
    
     


Set ToolTip Placement, ShowDuration, VerticalOffset

image_pdfimage_print


   
     

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="200" Width="300">
    <StackPanel>
        <Button Height="40" Margin="5" ToolTipService.HorizontalOffset="5cm" 
                ToolTipService.Placement="Relative" 
                ToolTipService.ShowDuration="10000" 
                ToolTipService.VerticalOffset="50px">
            <Button.ToolTip>
                <ToolTip >
                    ToolTip displayed for 10 seconds...
                </ToolTip>
            </Button.ToolTip>
            Button with offset ToolTip
        </Button>
    </StackPanel>
</Window>

   
    
    
    
    
     


Set ToolTipService.Placement=”Center”

image_pdfimage_print


   
     

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="200" Width="300">
    <StackPanel>

        <Button Height="40" Margin="5" ToolTipService.Placement="Center">
            <Button.ToolTip>
                <ToolTip>
                    ToolTip displayed for 5 seconds...
                </ToolTip>
            </Button.ToolTip>
            Button with Centered ToolTip
        </Button>
    </StackPanel>
</Window>

   
    
    
    
    
     


ToolTip with Image

image_pdfimage_print


   
     

<Window x:Class="ClassicControls.Tooltips"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Tooltips" Height="321" Width="301"   >
  <StackPanel Margin="5" ToolTip="StackPanel tooltip">
    <Button ToolTipService.InitialShowDelay="0" ToolTipService.BetweenShowDelay="5000">
      <Button.ToolTip>
        <ToolTip Background="#60AA4030" Foreground="White"
                 HasDropShadow="False" >
        <StackPanel>
          <TextBlock Margin="3" >Image and text</TextBlock>
          <Image Source="c:image.jpg" Stretch="None" />
          <TextBlock Margin="3" >Image and text</TextBlock>          
        </StackPanel>
        </ToolTip>
        </Button.ToolTip>      
      <Button.Content>I have a fancy tooltip</Button.Content>
    </Button>      
  </StackPanel>
        
    
</Window>

   
    
    
    
    
     


ToolTipService.Placement=”Bottom”

image_pdfimage_print


   
     
<Window x:Class="ClassicControls.Tooltips"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Tooltips" Height="321" Width="301"   >
  <StackPanel Margin="5" ToolTip="StackPanel tooltip">
    <Button ToolTip="This is my tooltip"  ToolTipService.Placement="Bottom">Placement test</Button>
  </StackPanel>
        
    
</Window>

   
    
    
    
    
     


ToolTip with List items

image_pdfimage_print


   
     

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="150" Width="300">
    <StackPanel Name="stackPanel1">
        <Button Content="Button with a Richer ToolTip" Height="23" 
                Margin="10" Name="button2" Width="175">
            <Button.ToolTip>
                <StackPanel Name="stackPanel2" Width="200">
                    <Label Name="label1" HorizontalAlignment="Left">
                        List of Things:
                    </Label>
                    <ListBox Name="listBox1" Margin="10" >
                        <ListBoxItem>Thing 1</ListBoxItem>
                        <ListBoxItem>Thing 2</ListBoxItem>
                        <ListBoxItem>Thing 3</ListBoxItem>
                    </ListBox>
                </StackPanel>
            </Button.ToolTip>
        </Button>

    </StackPanel>
</Window>