private static void IsValidChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
if (!GetIsEnabled(obj))
{
throw new InvalidOperationException("The IsValid attached property can only be used when the IsEnabled "
+ "attached property is set to true.");
}
Binding binding = BindingOperations.GetBinding(obj, IsValidProperty);
if (binding != null)
{
CheckBindingMode(binding.Mode);
return;
}
MultiBinding multiBinding = BindingOperations.GetMultiBinding(obj, IsValidProperty);
if (multiBinding != null)
{
CheckBindingMode(multiBinding.Mode);
return;
}
PriorityBinding priorityBinding = BindingOperations.GetPriorityBinding(obj, IsValidProperty);
if (priorityBinding != null)
{
throw new InvalidOperationException("PriorityBinding is not supported for the IsValid attached dependency property!");
}
}