Ho un ExceptionValidationRule
sul mio TextBox:ExceptionValidationRule non reagisce alle eccezioni
<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}" />
e MyProperty
sembra che:
private int myProperty;
public int MyProperty
{
get { return myProperty; }
set
{
if(value > 10)
throw new ArgumentException("LOL that's an error");
myProperty = value;
}
}
In modalità DEBUG
, applicazione si blocca con un'eccezione non gestita "LOL that's an error"
(WPF Binding Engine non cattura questo e penso che dovrebbe ...).
Nella modalità RELEASE
, tutto funziona correttamente.
Qualcuno può dirmi, perché diavolo sta accadendo? E come posso risolvere questo?
È stato associato un evento UnhandledException? – Krimson