ValidationHelper

Applies to any UIElement. Four properties, all of them about the popup MahApps shows next to a control whose binding failed validation.

Property Type Default
CloseOnMouseLeftButtonDown bool false clicking anywhere dismisses the popup
ShowValidationErrorOnMouseOver bool false show the error while the pointer is over the red triangle rather than only while the control has focus
ShowValidationErrorOnKeyboardFocus bool true the focus route itself, which this is what switches off
AlwaysShowValidationError bool false keep the message up whatever the focus and the pointer do

The last two are new in develop and are not in 2.4.11, which has the first two.

<TextBox Text="{Binding Age, ValidatesOnDataErrors=True}"
         mah:ValidationHelper.ShowValidationErrorOnMouseOver="True"
         mah:ValidationHelper.CloseOnMouseLeftButtonDown="True" />

By default the error popup appears while the control has keyboard focus. That works while the user is filling a form in, but it means an error on a field they have moved away from is invisible — ShowValidationErrorOnMouseOver gives them a way to read it again without tabbing back.

CloseOnMouseLeftButtonDown suits a long message that would otherwise cover the controls beneath it.

Both can be set once for the whole window rather than per control:

<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
    <Setter Property="mah:ValidationHelper.ShowValidationErrorOnMouseOver" Value="True" />
</Style>

The template the popup uses is MahApps.Templates.ValidationError, which the input control styles set as Validation.ErrorTemplate. Replace that resource to change what an error looks like rather than how it behaves.