Programmatically calling validation in a rehosted Workflow 4 designer
The workflow designer has a rich programming model that supports communication with the host. A rehosted workflow designer will automatically validate a workflow when it is changed; in order to programmatically call validation on demand on a rehosted designer, use the following method:
designer.Context.Services.GetService<ValidationService>().ValidateWorkflow();
To handle resulting validation errors, publish an implementation of IValidationErrorService, which will expose the set of errors through ValidationService.NavigateTo(). For information on how to do this, see the following topic: