Greetings,
I have developed a WPF MVVM DevForce application with DevForce version 6.1.
On my main screen, I have many fields where the user enters information. The input fields, textboxes, are binding to DevForce entity properties, which then get saved off to the database. Before I do a save, I do instance validation on the entity. Our business rules are very complex, so I added customer verifiers (often to check for an entered value) for most of the properties in the entity. This is working great. If I leave out a required value, the instance validation catches the violation as it should.
My issue is with the controls displaying the validation error. The user is entering new information, and so we are creating a new entity and all values are empty. When the user clicks to save the information, and the instance validation is performed, I display a message containing information about each Verifier that failed. However, the errors are not bubbling up to the GUI and the controls. I would like the controls to also display the validation error so the user can see which fields need information. I can get a control to display an error if I enter a value in a required field, click another control, then go back and remove the value. However, if I skip required field and hit save, I then want the control to display the error.
Our default error notification mode is Notify. The controls have ValidatesOnDataErrors=true and NotifyOnValidationError=true, which works perfectly if they input a value, and then later delete it as I described above. However, it would make sense and would help the user if this also happened when they clicked save and there were required fields with missing data.
Here is an example of our binding:
<TextBox Name="txtHomePhone2" Width="120" Text="{Binding Path=DebtorPhone2,
ValidatesOnDataErrors=true, NotifyOnValidationError=true}" />
And here is an example of a verifier:
private static VerifierResult Phone2RequiredCondition(**** pTarget, TriggerContext pTriggerContext,
VerifierContext pVerifierContext)
{
if (pTriggerContext != null && pTriggerContext.Timing == TriggerTiming.BeforeSet)
{
throw new VerifierException("Phone2Required verifier not implemented for Preset");
}
bool isOk = pTarget.RefusedInfo || (!pTarget.RefusedInfo
&& !String.IsNullOrWhiteSpace(pTarget.Phone2));
return new VerifierResult(isOk);
}
Any help would be appreciated. Thanks.