Mam ExceptionValidationRule
na moim TextBox:ExceptionValidationRule nie reaguje na wyjątkami
<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}" />
i MyProperty
wygląda tak:
private int myProperty;
public int MyProperty
{
get { return myProperty; }
set
{
if(value > 10)
throw new ArgumentException("LOL that's an error");
myProperty = value;
}
}
W trybie DEBUG
, awarii aplikacji z nieobsługiwany wyjątek "LOL that's an error"
(WPF Binding Engine nie łapie tego i myślę, że powinien ...).
W trybie RELEASE
wszystko działa poprawnie.
Czy ktoś może mi powiedzieć, dlaczego to się dzieje, do cholery,? I jak mogę to naprawić?
Czy masz dołączone wydarzenie UnhandledException? – Krimson