I've an MVVM application implementing IDataErrorInfo using version 3.5. I want to try and target 4.0 so have amended the Target Framework setting and changed a few bits around (BitmapFrames and the like). Most things seem just fine and the process was relatively painless, until I noticed that the implentation of IDataErrorInfo has been affected.
My control template for validation looks like this:
<ControlTemplate x:Key="temp__">
<Border BorderBrush="Orange" BorderThickness="2" CornerRadius="4" SnapsToDevicePixels="True">
<DockPanel>
<Image HorizontalAlignment="Left" VerticalAlignment="Center"
Width="16" Height="16" Margin="-20,0,0,0"
Source="{StaticResource ErrorIcon}"
ToolTip="{Binding ElementName=adornedElement,
Path=AdornedElement.(Validation.Errors),
Converter={helper:ValidationErrorsToStringConverter}}"/>
<AdornedElementPlaceholder Name="adornedElement"/>
</DockPanel>
</Border>
</ControlTemplate>
and is used in a textbox style like this:
<Setter Property="Validation.ErrorTemplate" Value="{DynamicResource error_holder}">
In my ViewModel, GetValidationError(string propertyName) uses a switch to validate the appropriate property based on my rules.
The issue is that once a validation has been fired it does not update. For instance, a field can be set as required or not. When loaded, the fields that are required are marked as invalid with an appropriate message. Previously, when a value was entered that was still invalid the error message in the tooltip would update. However this no longer works and the error message still remains as a null value message.
Does anyone know of any changes in the implementation of IDataErrorInfo in 4.0 that may account for this? Any idea how to fix it?