
I set up a view bound to a viewmodel something like this:
<editors:Int32EditBox Value="{Binding AwesomeThing}" Maximum="{Binding Max}" />
The bound class uses INotifyDataErrorInfo to validate input and there is a style that displays the validation
<Style TargetType="editors:Int32EditBox">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="Background" Value="Pink" />
<Setter Property="FrameworkElement.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>
Both the value and the max are sometimes updated by other code. If they are updated in such a way that the AwesomeThing is greater than the Max, the editbox will run some coercion logic and display Max instead of AwesomeThing. This is a problem because now my validation is showing an error indicating an invalid value, but the control is showing a valid value.
Is there a way to turn off this coercion? I want to keep the max value in place because it makes user input nice, but I very much need the editbox to show the current value of the bound property even when it is outside the min/max.
[Modified 1 year ago]