private static BindingValidator ValidatorFor(Type guiElement, Type presenterType) { var boundType = new BoundType(presenterType); object instance = Activator.CreateInstance(guiElement); return(new BindingValidator(Bound.DependencyObject((DependencyObject)instance, boundType))); }