public static void SetValidation(this FrameworkElement frameworkElement, string message) { CustomValidation customValidation = new CustomValidation(message); Binding binding = new Binding("ValidationError") { Mode = System.Windows.Data.BindingMode.TwoWay, NotifyOnValidationError = true, ValidatesOnExceptions = true, Source = customValidation }; frameworkElement.SetBinding(Control.TagProperty, binding); }