Using exception validation
<TextBox>
<Binding Path="Value"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox>
for this property
int _value = 1;
public int Value
{
get { return _value; }
set
{
if (value < 1)
throw new ArgumentException();
_value = value;
OnPropertyChanged();
}
}
If I enter nonsense (e.g. 1asdkfjlsdf
) TextBox
will get a red border. Fine.
But as soon as I enter 0
while debugging break will occurs
and I have to click Continue on debugging bar every time.
Without debugging it work as expected: red border for either 12093813asdf
or 0
value.
Question: how do I prevent that break?
I can un-check specific exception (arrow on screenshot), but I want breaks when this exception occurs in other places (e.g. in Model logic ArgumentException
is thrown in some methods too). I can make my own exception, throw it and un-check it, but I am not happy with that either.