title: Programmatically showing a ToolTip
body: <p>I have developed a WPF sample project.</p>
  
  <p>Here is the main Window's XAML markup :</p>
  
  <pre><code>&lt;Window x:Class="ToolTipSample.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"
          WindowState="Maximized"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto" /&gt;
              &lt;RowDefinition Height="*" /&gt;
              &lt;RowDefinition Height="Auto" /&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;Button Click="OnButtonClick"&gt;Show ToolTip&lt;/Button&gt;
  
          &lt;StatusBar Grid.Row="2"&gt;
              &lt;StatusBarItem&gt;
                  &lt;TextBlock Text="TextBlock With ToolTip"&gt;
                      &lt;TextBlock.ToolTip&gt;
                          &lt;ToolTip x:Name="m_toolTip"&gt;
                              ToolTip
                          &lt;/ToolTip&gt;
                      &lt;/TextBlock.ToolTip&gt;
                  &lt;/TextBlock&gt;
              &lt;/StatusBarItem&gt;
          &lt;/StatusBar&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Here is the main Window's code-behind without the using statements :</p>
  
  <pre><code>namespace ToolTipSample
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
          }
  
          private void OnButtonClick(object p_sender, RoutedEventArgs p_args)
          {
              m_toolTip.IsOpen = true;
          }
      }
  }
  </code></pre>
  
  <p>I want to programmatically show the ToolTip when the Button is clicked.<br>
  I want the ToolTip to be shown above its TextBlock parent.</p>
  
  <p>The ToolTip is automatically shown when the mouse cursor is over the TextBlock and during a constant amount of time C approximatively equal to 5 seconds.<br>
  I want the ToolTip to be shown during C when the Button is clicked.</p>
  
  <p>My goals are not achieved in the current project.<br>
  The ToolTip is shown when the Button is clicked :</p>
  
  <p><img src="https://i.stack.imgur.com/EmL5A.png" alt="enter image description here"></p>
  
  <p>But :</p>
  
  <ul>
  <li>The ToolTip is too far from its TextBlock parent.</li>
  <li>The ToolTip is not automatically hidden</li>
  </ul>
  
  <p>What do I have to do to achieve my goals ?<br>
  Any help will be greatly appreciated.</p>