============================================================================
========= KOD CS
#region Email
[Category("Custom"), Description("Wprowadzony adres E-mail")]
public string Email
{
get { return (string)GetValue(EmailProperty); }
set
{
if (!ValueChecker.IsWithValue(value))
throw new ArgumentException("Wprowadź e-mail");
else
if (!ValueChecker.IsMail(value))
throw new ArgumentException("Wprowadź poprawny adres e-mail");
SetValue(EmailProperty, value);
}
}
public static readonly DependencyProperty EmailProperty =
DependencyProperty.Register("Email", typeof(string), typeof(MailConfirmationPanel), new PropertyMetadata(""));
#endregion
============================================================================
========= KOD XAML
<TextBox
FontSize="14"
Style="{StaticResource InputTextBox}"
IsEnabled="{Binding ElementName=hUserControl, Path=IsChangeEmailEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
MinWidth="150">
<TextBox.Text>
<Binding ElementName="hUserControl" Path="Email" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
Dlaczego textbox nie potrafi obłużyć wyjątku? Mogę prosić o wytłumaczenie? W dokumentacji jest napisane, że wyjątek musi zostać utworzony podczas trwania ustawiania wartości. i tak się przecież dzieje.