I have a simple WPF Grid with two rows and two columns. The second column contains TextBox-es which are bound to some view model properties. I need to customize these TextBoxes validation ErrorTemplates to display validation error just above the problem box.
Following code
<Style TargetType="Control" x:Key="ValidationControlStyle">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<StackPanel>
<TextBlock Foreground="Red"
Text="{Binding ElementName=ErrorAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"/>
<AdornedElementPlaceholder x:Name="ErrorAdorner"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
gives very ugly result when error message visually overlaps above row (see picture below)
How can I place validation error just above the problem field (Grid row should increase its height)?