This project is read-only.

Datagrid cell validation support

Jan 4, 2016 at 9:12 AM
Hi,
Am trying to validate a cell content using IDataErrorInfo in the view model. For an invalid cell context, a red box appear around a cell. However, when I hover the mouse over the cell, tool tip isn't displayed. I found out that Validation.HasError is false.

Is there any inbuilt support for validation?

Here's my sample xaml and style:
<extendedColumn:ExtendedDataGridTextColumn Header="Object" AllowAutoFilter="False" Binding="{Binding Object, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"          CanUserSort="False" CellStyle = "{StaticResource  ResourceKey=TextBlockStyle}" ></extendedColumn:ExtendedDataGridTextColumn>
style:
<Style x:Key="TextBlockStyle" TargetType="{x:Type DataGridCell}">
   <Style.Triggers>
 <Trigger Property="Validation.HasError" Value="True" >
 <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent, diag:PresentationTraceSources.TraceLevel = High}"/>
   </Trigger>
 </Style.Triggers>
  </Style>