Good day
I am using LLBLGen Pro 2.6, WPF, C#, SQL Server 2005.
I have a partial entity class in which I override OnValidateFieldValue.
eg.
protected override bool OnValidateFieldValue(int fieldIndex, object value)
{
bool toReturn = true;
switch ((TraderLimitsFieldIndex)fieldIndex)
{
case TraderLimitsFieldIndex.Limit:
toReturn = ((double)value > 0);
if (toReturn == false)
SetEntityFieldError("Limit", "Limit must be positive", false);
break;
default:
toReturn = true;
break;
}
return toReturn;
}
within the same partial class I have method IsValid():
public Boolean IsValid()
{
if (DataErrorInfoErrorsPerField == null)
return true;
else
return (DataErrorInfoErrorsPerField.Count == 0);
}
On the WPF-side I use a MVVM architecture, where I check to see if the form can be saved by calling my entities new IsValid() method. If false I disable the control.
This works fine, but... when I delete the bound value's data from the window, the form textbox validates correctly by displaying the relevant llblgen built-in logic error, but my control does not disable. My question is, how can I get access to this error from within my IsValid method in order to check for the built-in validation errors also?
the xaml looks like this:
<TextBox FontWeight="Normal" FontSize="11" Width="150" VerticalContentAlignment="Center"
Text="{Binding Path=Limit,
UpdateSourceTrigger=PropertyChanged,
Mode=TwoWay,
StringFormat='{0:#,##0}',
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}"
fw:NumericTextBoxBehavior.IsEnabled="True"/>
Regards
Johan