private void ValidateObjects(IEnumerable targets) { //string validationContext = "Immediate"; RuleSetValidationResult result = Validator.RuleSet.ValidateAllTargets(targets); //, validationContext); List <ResultsHighlightController> resultsHighlightControllers = new List <ResultsHighlightController>(); resultsHighlightControllers.Add(Frame.GetController <ResultsHighlightController>()); if (View is DetailView) { foreach (ListPropertyEditor listPropertyEditor in ((DetailView)View).GetItems <ListPropertyEditor>()) { //if (listPropertyEditor.Frame.GetController<ResultsHighlightController>() == null) continue; if (listPropertyEditor.Frame == null) { continue; } ResultsHighlightController nestedController = listPropertyEditor.Frame.GetController <ResultsHighlightController>(); if (nestedController != null) { resultsHighlightControllers.Add(nestedController); } } } foreach (ResultsHighlightController resultsHighlightController in resultsHighlightControllers) { //resultsHighlightController.View.ObjectSpace.ModifiedObjects[0] resultsHighlightController.ClearHighlighting(); if (result.State == ValidationState.Invalid) { resultsHighlightController.HighlightResults(result); } } }
private void ValidateObjects(IEnumerable targets) { if (targets == null) { return; } ResultsHighlightController resultsHighlightController = Frame.GetController <ResultsHighlightController>(); if (resultsHighlightController != null) { RuleSetValidationResult result = Validator.RuleSet.ValidateAllTargets(ObjectSpace, targets, DefaultContexts.Save); if (result.ValidationOutcome == ValidationOutcome.Error || result.ValidationOutcome == ValidationOutcome.Warning || result.ValidationOutcome == ValidationOutcome.Information) { resultsHighlightController.HighlightResults(result); } else { resultsHighlightController.ClearHighlighting(); } } }