Wednesday, 7 August 2013

WPF DataGridRow INotifyDataErrorInfo as Tooltip buggy

WPF DataGridRow INotifyDataErrorInfo as Tooltip buggy

my buisinessobject implements the INotifyDataErrorInfo and it works great
with other controls, like textbox, combobx, datepicker ...
but now i use a DataGrid (WPF 4.5) and want that all Errors ars displayed
as a Tooltip for the DataGridRow that is binded to the BO with errors.
Here my DataGrid sample
<DataGrid ItemsSource="{Binding Persons}" AutoGenerateColumns="False"
SelectionMode="Single" SelectionUnit="FullRow">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding
RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding
Path=Name}" Width="*" />
<DataGridTextColumn Header="Age" Binding="{Binding Path=Age}"
Width="*"/>
</DataGrid.Columns>
</DataGrid>
if i change the Age to produce an error the Grid looks like this

No tooltip is shown if i move the mouse over the row or cell :(
after i enter the editmode of the cell with the error again, the tooptip
is visible. For the row and cell.

If i remove the error the red border of the cell will disappear BUT the
tooltip with the error is not gone???

The row is not realy synconized with the errors of his cells.
How can i fix this behavior?
THX for every hint!
Regards Tam

No comments:

Post a Comment