The following works and ErrorHandler in my code behind is called.
XAML :
<Window Validation.Error="ErrorHandler">
<TextBox>
<TextBox.Text>
<Binding Path="SomeProperty" NotifyOnValidationError="True">
<local:MyValidationRule />
</Binding>
</TextBox.Text>
</TextBox>
</Window>
CS:
private void ErrorHandler(object sender, ValidationErrorEventArgs e)
{
............
}
Now i would like to transfer that to my ViewModel using Caliburn Micro's Message.Attach The delegated method is never called, any idea why ?
XAML :
<Window cal:Message.Attach="[Event Validation.Error] = [Action OnErrorsChanged($eventArgs)]">
<TextBox>
<TextBox.Text>
<Binding Path="SomeProperty" NotifyOnValidationError="True">
<local:MyValidationRule />
</Binding>
</TextBox.Text>
</TextBox>
</Window>
CS: (In My ViewModel)
private void OnErrorsChanged(ValidationErrorEventArgs e)
{
............ this code is never reached.
}
Edit : This also doesn't work
<i:Interaction.Triggers>
<i:EventTrigger EventName="Validation.Error">
<cal:ActionMessage MethodName="OnErrorsChanged" />
</i:EventTrigger>
</i:Interaction.Triggers>
Thanks.