j'ai un ExceptionValidationRule
sur mon TextBox:ExceptionValidationRule ne réagit pas aux exceptions
<Window.Resources>
<Style x:Key="textStyleTextBox" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<TextBox x:Name="myTextBox"
{Binding Path=MyProperty, ValidatesOnExceptions=True}"
Style="{StaticResource ResourceKey=textStyleTextBox}" />
et MyProperty
ressemble à ça:
private int myProperty;
public int MyProperty
{
get { return myProperty; }
set
{
if(value > 10)
throw new ArgumentException("LOL that's an error");
myProperty = value;
}
}
En mode DEBUG
, application se bloque à l'exception non gérée "LOL that's an error"
(WPF Le moteur de liaison n'attrape pas ceci et je pense qu'il devrait ...). En mode RELEASE
, tout fonctionne correctement.
Quelqu'un peut-il me dire, pourquoi diable est-ce que cela se passe? Et comment puis-je résoudre ce problème?
Avez-vous un événement UnhandledException joint? – Krimson