Is there a way to create a validation rule which has bindable boundaries? Creating dependencyproperties requires the class in question to be a dependencyobject, which neither ValidationRule nor ValidationAttributes are.
What I want is something similar to this:
<Binding.ValidationRules>
<c:AgeRangeRule
Min="{Binding CalculatedMinAge}"
Max="{Binding CalculatedMaxAge}"/>
</Binding.ValidationRules>
Where both CalculatedMinAge and CalculatedMaxAge are properties on my ViewModel which gets calculated base on some other user input in the same dialog (and thus may change, rendering the age, which the user already entered, invalid).
Is this possible to do?
Is there any other way to obtain the result which would come from this?
I need the solution to be awailable in WPF, C#4.
PS: The example is a thought up example. My real world example requires knowledge of domain. For simplicity, lets say that CalculatedMinAge and CalculatedMaxAge depends on which product the user wants to buy.