title: WPF: Show Tooltip message on custom DataGrid cells when IDataErrorInfo
body: <p>I'm pretty new to WPF but I've read a lot on it as well as MVVM in the last couple if days.
  My WPF displays a DataGrid with custom column templates (using the NumericUpDown Controls from Xceed WPF Toolkit). Three of the columns contain the decimal coordinates of a 3D vector. I use IDataErrorInfo to make sure the vector's length is never 0 (all three columns cannot be 0 at the same time). This is working fine so far, the cells are marked red when the validation fails, but I also want to show the error message in a tooltip or similar.</p>
  
  <pre><code>&lt;DataGrid [...]&gt;
      &lt;DataGrid.Columns&gt;
          [...]
          &lt;DataGridTemplateColumn Header="X" [...]&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;xctk:DecimalUpDown Value="{Binding PositionX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"&gt;
                      &lt;/xctk:DecimalUpDown&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
          [... and same thing for Y and Z]
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>This is where I'm stuck for a few hours now, so I hope you can help me here:</p>
  
  <p><strong>How can I show a error tooltip on custom template columns?</strong></p>
  
  <p>I've read through a lot of articles and threads on error tooltips but most of them are on plain TextBox or DataGridTextColumns and a tried a lot but could not make it working so far.</p>
  
  <p>Most of them look something like this: </p>
  
  <pre><code>&lt;Style x:Key="errorStyle" TargetType="{x:Type TextBox}"&gt;
      &lt;Setter Property="Padding" Value="-2"/&gt;
      &lt;Style.Triggers&gt;
          &lt;Trigger Property="Validation.HasError" Value="True"&gt;
              &lt;Setter Property="Background" Value="Red"/&gt;
              &lt;Setter Property="ToolTip" 
                  Value="{Binding RelativeSource={RelativeSource Self},
                  Path=(Validation.Errors)[0].ErrorContent}"/&gt;
          &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>from here:
  <a href="https://msdn.microsoft.com/library/ee622975%28v=vs.100%29.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/library/ee622975%28v=vs.100%29.aspx</a></p>
  
  <p>or more exsamples:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/7504408/display-validation-error-in-datagridcell-tooltip">Display validation error in DataGridCell tooltip</a></li>
  <li><a href="https://stackoverflow.com/a/7900510/5025424">https://stackoverflow.com/a/7900510/5025424</a></li>
  <li><a href="https://harishasanblog.blogspot.de/2011/01/datagrid-validation-using.html" rel="nofollow noreferrer">https://harishasanblog.blogspot.de/2011/01/datagrid-validation-using.html</a></li>
  <li><a href="https://stackoverflow.com/questions/12384781/wpf-data-validation-and-display-error-message-idataerrorinfo-and-error-templates">WPF data validation and display error message IDataErrorInfo and error templates</a></li>
  </ul>
  
  <p>Nothing on this ever showed any Tooltip to me.</p>
  
  <p>Can you give me a hint, </p>
  
  <ul>
  <li><strong>how</strong> this style trigger definition has to look for cells containing no TextBox, </li>
  <li><strong>where</strong> the definition has to be</li>
  <li>and if the column needs the reference this definition in some way?</li>
  </ul>
  
  <p>Thank you!</p>