title: WPF: ToolTip in New Window
body: <p>I have the following style for a ToolTip:</p>
  
  <pre><code>        &lt;Style x:Key="ToolTipPopUp" TargetType="{x:Type ContentControl}"&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="{x:Type ContentControl}"&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;StackPanel.ToolTip&gt;
                                  &lt;ToolTip Visibility="Hidden" /&gt;
                              &lt;/StackPanel.ToolTip&gt;
                              &lt;ContentPresenter /&gt;
                              &lt;Image Source="/Resources/info.png" 
                                     ToolTip="{TemplateBinding ToolTip}"
                                     Height="12"
                                     VerticalAlignment="Top" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
  </code></pre>
  
  <p>This is called via:</p>
  
  <pre><code>            &lt;ContentControl Style="{StaticResource ToolTipPopUp}" ToolTip="Hello world"&gt;
                  &lt;CheckBox Content="I am a check box" /&gt;
              &lt;/ContentControl&gt;
  </code></pre>
  
  <p>This allows me to attach a <code>ToolTip</code> to any control I want and displays the <code>ToolTip</code> as expected.</p>
  
  <p><img src="https://i.stack.imgur.com/dJIrW.png" alt="enter image description here"></p>
  
  <p>The customer is now requesting that the <code>ToolTip</code> be shown in a pop-up window as the content can sometimes be rather lengthy.</p>
  
  <p>Is there a way to convert this style to show a pop-up window?  I have read that a <code>Window</code> cannot be used by <code>ContentControl</code> so if there is a different way to do this I am open to that.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have a static resource of the instructions (not shown for clarity) that I bind to the ToolTip (that is what I am doing now).  I was thinking of creating a singleton window that would open when the user clicks on the tooltip icon (blue 'i'), would update a property in the pop-up window (i.e., the tooltip content) whenever a tooltip icon is clicked (so if the window is already open, the instructions within the window change).  The user can then close the window when they chose.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>Thanks to Theodosius for pointing me in the right direction.  Here is how I implemented this:</p>
  
  <p>MainPageViewModel.cs (top-most window of executing program):</p>
  
  <pre><code>    private Window _toolTipWindow;
  
      /// &lt;summary&gt;
      /// Display the tool tip text in a new window
      /// &lt;/summary&gt;
      public void ToolTipPopUpClicked(object sender, RoutedEventArgs e)
      {
          if (_toolTipWindow == null || !_toolTipWindow.IsVisible)
          {
              _toolTipWindow = new Window();
          }
  
          String _instructions = (((Button)sender).TemplatedParent as ContentControl).ToolTip.ToString();
  
          _toolTipWindow.Width = 300;
          _toolTipWindow.Height = 200;
  
          _toolTipWindow.Content = _instructions;
          _toolTipWindow.Show();
      }
  </code></pre>
  
  <p><strong>StylesDictionary.xaml</strong></p>
  
  <pre><code>&lt;Style x:Key="ToolTipPopUp" TargetType="{x:Type ContentControl}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type ContentControl}"&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;ContentPresenter /&gt;
                      &lt;Button Width="Auto"&gt;
                          &lt;i:Interaction.Triggers&gt;
                              &lt;i:EventTrigger EventName="Click"&gt;
                                  &lt;ei:CallMethodAction TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}},
                                                                                          Path=DataContext}"
                                                               MethodName="ToolTipPopUpClicked" /&gt;
                              &lt;/i:EventTrigger&gt;
                          &lt;/i:Interaction.Triggers&gt;
                          &lt;Button.Template&gt;
                              &lt;ControlTemplate&gt;
                                  &lt;Image Source="Resources/info.png" 
                                              ToolTip="{TemplateBinding ToolTip}"
                                              Height="12"
                                              VerticalAlignment="Top" &gt;
  
                                  &lt;/Image&gt;
                              &lt;/ControlTemplate&gt;
                          &lt;/Button.Template&gt;
                      &lt;/Button&gt;
                  &lt;/StackPanel&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p><strong>XAML file</strong></p>
  
  <pre><code>            &lt;ContentControl Name="PopupExample" 
                              Style="{StaticResource ToolTipPopUp}" 
                              ToolTip="Hello world"&gt;
                  &lt;CheckBox Content="I am a check box" /&gt;
              &lt;/ContentControl&gt;
  </code></pre>
  
  <p>This retains the standard <code>ToolTip</code> functionality and provides a pop-up window when the user clicks on the tool tip icon (blue 'i').</p>