I am working on trying to get the data verification to work with WPF and cannot seem to figure out how to use the verification built into DevForce. I currently added the below code to my app.xaml and am getting the notices of errors however, the error messages are not correct.
On a field that is required, I am getting this error:
Exception has been thrown by the target of an invocation.
Then on a field that is not required and left blank, I am getting this error:
Input string was not in a correct format.
Are there any examples on how to use the built in DevForce verification with WPF?
Here is what I have in my app file:
<ControlTemplate x:Key="validationTemplate">
<DockPanel>
<TextBlock Margin="5,0,5,0" Foreground="Red" FontSize="16" VerticalAlignment="Center" Text="*" ToolTip="{Binding ElementName=errorAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
<AdornedElementPlaceholder x:Name="errorAdorner" />
</DockPanel>
</ControlTemplate>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource validationTemplate}" />
</Style>
Here is an example of one of my textboxes:
<TextBox Grid.Column="1" Grid.Row="5" Text="{Binding CurrentVehicle.Description, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="Auto" Width="Auto" />