Reputation: 12328
There is this user control. It contains validation logic. The user control contains several input controls. These input controls are not invalid or valid on their own, but the combination of these values in the input controls is either valid or not. This means that a validation error never arises. Because no binding will ever cause a validation error. The ViewModel (re)validates itself when it notices any of the values in the input controls have changed and sets its IsValid property.
Now in a parent view this control is implemented, among other input controls, and the parent catches validation errors using the following event.
EventManager.RegisterClassHandler(typeof(ParentView), Validation.ErrorEvent, new RoutedEventHandler(ValidationError));
The issue is that the user control is not raising this event, because there is not control with a binding that is invalid. (Due to the validity depends on the combination of values, not a single control).
Currently I am looking at raising this Validation.ErrorEvent
in code behind, but I doubt that is the way to go, if it would work at all.
How would I go about this?
Upvotes: 0
Views: 551