title: WPF - MVVM : Datagrid validation, Tooltip wrih error message don't work
body: <p>I'm implementing validation on datagrid cells through validation rules.</p>
  
  <p>I get the validation working on the cell editing, but no way to display a tooltip with the error message. I get the error Icon when the cell value is out of range, but not the error message tooltip.</p>
  
  <p>This is the XAML code:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;local:DatagridViewModel x:Key="ViewModel"/&gt;
      &lt;CollectionViewSource x:Key="cvsEntries" Source="{Binding LineItems, Source={StaticResource ViewModel}}"/&gt;
  
      &lt;Style TargetType="{x:Type DataGridRow}"&gt;
          &lt;Setter Property="ValidationErrorTemplate"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate&gt;
                      &lt;Image Source="../Images/error.png" ToolTip="{Binding  RelativeSource={RelativeSource Self}, Path=(Validation.Errors).CurrentItem}" Margin="0"  Width="15" Height="15" /&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/UserControl.Resources&gt;
  
  &lt;DataGrid x:Name="lineItemGrid" Grid.ColumnSpan="5" Grid.Row="13" Background="#FFD6E9F5" ItemsSource="{Binding Source={StaticResource cvsEntries}}" AutoGenerateColumns="False" CanUserDeleteRows="False" VerticalContentAlignment="Stretch" Margin="0,4,0,0" SelectionMode="Single"  SelectedItem="{Binding SelectedLineItem}"&gt;
      &lt;DataGrid.Resources&gt;
          &lt;SolidColorBrush x:Key="DataGridDeployedTextForeground" Color="#FF409540"/&gt;
          &lt;SolidColorBrush x:Key="DataGridObsoleteTextForeground" Color="#FF934440"/&gt;
          &lt;SolidColorBrush x:Key="DataGridDraftTextForeground" Color="#FF654093"/&gt;
  
      &lt;/DataGrid.Resources&gt;
      &lt;DataGrid.Columns&gt;
  
          &lt;DataGridTextColumn  Binding="{Binding Product, Mode=OneWay}" Header="Product" IsReadOnly="True"/&gt;
          &lt;DataGridTextColumn Binding="{Binding State, Mode=OneWay}" Header="State"   SortMemberPath="State" IsReadOnly="True"/&gt;
          &lt;DataGridTextColumn Header="Cust.Opt"&gt;
              &lt;DataGridTextColumn.Binding&gt;
                  &lt;Binding Path="CustomAttributeValue" UpdateSourceTrigger="PropertyChanged"&gt;
                      &lt;Binding.ValidationRules&gt;
                              &lt;local:PropertyValidation&gt;
                              &lt;local:PropertyValidation.ValidValue&gt;
                                  &lt;local:ValueChecker
                                      Minimum="{Binding Path=CustomAttributeMinValue, Source={StaticResource cvsEntries}}"
                                      Maximum="{Binding Path=CustomAttributeMaxValue, Source={StaticResource cvsEntries}}"/&gt;
                              &lt;/local:PropertyValidation.ValidValue&gt;
                          &lt;/local:PropertyValidation&gt;                                
                      &lt;/Binding.ValidationRules&gt;
                  &lt;/Binding&gt;
              &lt;/DataGridTextColumn.Binding&gt;
          &lt;/DataGridTextColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt; 
  </code></pre>
  
  <p>and this is the validation code:</p>
  
  <pre><code>public override ValidationResult Validate(object value, CultureInfo cultureInfo)
  {
    var result = new ValidationResult(true, null);
  
    var minValue = System.Convert.ToInt32(ValidValue.Minimum);
    var maxValue = System.Convert.ToInt32(ValidValue.Maximum);
    var valueToCheck = minValue;
    Error = "Error!!!";
  
    int.TryParse(value as string, out valueToCheck);
  
    CanBeValidated = true;
    if (minValue == -1 &amp;&amp; maxValue == -1 &amp;&amp; value == string.Empty)
    {
      value = null;
      CanBeValidated = false;
    }
  
    if (CanBeValidated == true &amp;&amp; (valueToCheck &lt; minValue || valueToCheck &gt; maxValue))
    {
      result = new ValidationResult(false, this.Error);
    }
    else
    {
      result = new ValidationResult(true, "OK");
    }
  
    return result;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this the attached properties:</p>
  
  <pre><code>public class ValueChecker : DependencyObject
  {
      public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register("Minimum", typeof(string), typeof(ValueChecker));
  
      public string Minimum
      {
        get
        {
          return (string)GetValue(MinimumProperty);
        }
        set
        {
          SetValue(MinimumProperty, value);
        }
      }
  
      public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(string), typeof(ValueChecker));
  
      public string Maximum
      {
        get
        {
          return (string)GetValue(MaximumProperty);
        }
        set
        {
          SetValue(MaximumProperty, value);
        }
      }
  </code></pre>
  
  <p>Thanks for any clue on this issue.</p>