Im using the validation rules as follows,
The problem is when the value is true like if i type aa or LastName(which are the right value and I return true) I got the following error ,if I put in the text box some wrong value there is no error (I see the red boarder), any idea what I miss here?
An unhandled exception of type 'System.StackOverflowException'
Currently the situation is that if I don't use the ValidatesOnTargetUpdated="True" there is no red boarder..
following the validation rules
public class PropertiesMapValidation : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
bool isValid = true;
var list = new List<String> { "aa", "LastName", "BusinessItem", "BusinessItems" };
var val = (string)value;
if (val != null)
{
ValidationResult result = null;
result = isValid
? new ValidationResult(true, null)
: new ValidationResult(false,
"The Field are not match");
return result;
}
}
THe xaml
<TextBox x:Name="FirstName" Grid.Column="4" Margin="0,50,0,0" Grid.Row="2" Style="{StaticResource tooltipError}" Height="24" Width="148">
<TextBox.Text>
<Binding ElementName="FirstName" Path="Text" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules >