title: WPF DataGridCell Styling - Binding for Tooltips on multiple columns
body: <p>I have a DataGrid that has an unknown number of columns. From the screenshot you will see there are 3 EF columns:</p>
  
  <p><a href="https://i.stack.imgur.com/ZLo8A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZLo8A.png" alt="enter image description here"></a></p>
  
  <p>What you cannot see is that each EF column has other columns that are hidden that holds other information about its respective EF column. For example, There is a hidden column before EF1 called 1Status (which is used to conditionally format the cell backgrounds based on its value), and another hidden column named 1AssMeth) which holds the text to appear in the tooltip. Ergo - For each <strong>EF[X]</strong> column there are the respective <strong>XStatus</strong> &amp; <strong>XAssMeth</strong>.</p>
  
  <p>As you can see, I have the conditional background colours working.</p>
  
  <p>The background colors are  handled using a ValueConverter and are implemented with the following Resource:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;ResourceDictionary&gt;
  
          &lt;local:PercVerifiedConverter x:Key="PercVerifiedConverter" /&gt;
          &lt;Style x:Key="PercVerified" TargetType="{x:Type DataGridCell}" &gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource PercVerifiedConverter}}" Value="Red"&gt;
                      &lt;Setter Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush&gt;
                                  &lt;GradientStop Color="DarkRed" Offset="0"/&gt;
                                  &lt;GradientStop Color="White" Offset="1"/&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                      &lt;Setter Property="Foreground" Value="White"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="Margin" Value="0"&gt;&lt;/Setter&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource PercVerifiedConverter}}" Value="Green"&gt;
                      &lt;Setter Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush&gt;
                                  &lt;GradientStop Color="DarkGreen" Offset="0"/&gt;
                                  &lt;GradientStop Color="White" Offset="1"/&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                      &lt;Setter Property="Foreground" Value="White"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="Margin" Value="0"&gt;&lt;/Setter&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource PercVerifiedConverter}}" Value="Orange"&gt;
                      &lt;Setter Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush&gt;
                                  &lt;GradientStop Color="DarkOrange" Offset="0"/&gt;
                                  &lt;GradientStop Color="White" Offset="1"/&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                      &lt;Setter Property="Foreground" Value="White"&gt;&lt;/Setter&gt;
                      &lt;Setter Property="Margin" Value="0"&gt;&lt;/Setter&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>So this all works as far as the background color works... However I wish to also add a Tooltip to the style to return the value in the respective XAssMeth column. So, to get things rolling I did this to the Style above...</p>
  
  <pre><code>        &lt;local:PercVerifiedConverter x:Key="PercVerifiedConverter" /&gt;
          &lt;Style x:Key="PercVerified" TargetType="{x:Type DataGridCell}" &gt;
  
              &lt;Setter Property="ToolTip" Value="{Binding 1AssMeth}" /&gt;
  
              &lt;Style.Triggers&gt; .....
  </code></pre>
  
  <p>Which as you might imagine returns a Tooltip as expected, but every column has the same tooltip - the value in the <strong>1AssMeth</strong> column.</p>
  
  <p>Hover over the first row in EF<a href="https://i.stack.imgur.com/ZLo8A.png" rel="nofollow noreferrer">1</a> and this tooltip appears
  <a href="https://i.stack.imgur.com/gZpU9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gZpU9.png" alt=" "></a></p>
  
  <p>Then hover over the first row of any subsequent columns and the same tooltip text appears.</p>
  
  <p><a href="https://i.stack.imgur.com/xuWtp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xuWtp.png" alt=""></a></p>
  
  <p>I would expect this behavior so am happy about that. What I need to know is how I might go about applying additional binding to the EF[X] columns so I get the correct Tooltip Text from the corresponding XAssMeth column - without loosing the functionality of my Background colour styling.</p>
  
  <p>I can supply more information on the converter or anything else if that might help - but i'm hoping it is something simple? i.e. do I need another converter to get the correct corresponding Column Header XAssMeth or anything like that? If so then an example would be amazing!</p>
  
  <p>P.s. I will be looking to expand on the Tooltip to make something customized - so if anyone is able to throw that into the mix as well, would be great!</p>