I want to replace the normal behaviour of Validation.ErrorTemplate. I want to put a background border object (filled with red color) behind my own UserControl and then apply a simple color animation to blink it.
I tried this in my implicit control style:
<Style TargetType="{x:Type local:myControl}">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<Border Name="ErrorBorder" CornerRadius"5" Background="Red">
<AdornedElementPlaceholder />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<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>
Unfortunately the border object entirely overlays the control UI. The other question is: where is the right place to put a DoubleAnimation applied on Opacity to make my Background blinking? Wich property/event should I trigger? Should I use style or simply place it in the Border.Triggers?
Thank you
I'm pretty sure this isn't possible, adorners are always drawn on top of the adorned element.
See the Adorners Overview on MSDN
"An Adorner is a custom FrameworkElement that is bound to a UIElement. Adorners are rendered in an AdornerLayer, which is a rendering surface that is always on top of the adorned element or a collection of adorned elements"
You could probably get the same effect by adorning with a normal border that just borders the adorned element instead of trying to stick it behind the adorned element.