Q:

WPF Validation error text overflow

Hello I am very new to xaml and I really don't know what such a bug is called.
 I have the following <ControlTemplate> and <Style> to display a validation error next to TextBoxes that I create on the code behind. The issue I'm having is the Text from the Validation Error overflow the Grid and the ScrollViewer doesn't expand for it as it does for other children in the Grid.
<UserControl.Resources>
    <local:ValidationModels x:Key="validationModels" textBox_Text=" " />
    <ControlTemplate x:Key="validationTemplate" >
        <DockPanel Grid.Column="2">
            <TextBlock Foreground="Red" FontSize="15" Text="Error"  DockPanel.Dock="Right"></TextBlock>
            <AdornedElementPlaceholder/>
        </DockPanel>
    </ControlTemplate>

    <Style x:Key="InputControlErrors" TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"    
          Value="{Binding RelativeSource={x:Static RelativeSource.Self},Path=(Validation.Errors)[0].ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</UserControl.Resources>

then I have the part of my xaml that has <ScrollViewer> <Grid>
      <StackPanel Orientation="Vertical">
        <Label Content="NCR Assignment" FontSize="32" FontWeight="Bold" HorizontalAlignment="Center" Margin="16"/>
        <ScrollViewer Height="314" Margin="48,0,52,0" HorizontalScrollBarVisibility="Auto"  VerticalScrollBarVisibility="Visible" >
            <Grid Name="NCRGrid" RenderTransformOrigin="0.365,0.559">
                <Grid.ColumnDefinitions >
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
            </Grid>
        </ScrollViewer>
        </StackPanel>

I add  TextBlock controls to the first column and TextBox controls to the second column of the Grid. 
The problem I'm facing is the ScrollViewer expands with the TextBlock text and TextBox field (I can scroll horizontally), but it doesn't expand for the validation error text from the ControlTemplate the only way I see it is by maximizing the window manually .
<ControlTemplate x:Key="validationTemplate" >
    <DockPanel Grid.Column="2">
        <TextBlock Foreground="Red" FontSize="15" Text="Error"  DockPanel.Dock="Right"></TextBlock>
        <AdornedElementPlaceholder/>
    </DockPanel>
</ControlTemplate>

I add both the of the TextBlock and TextBox objects to the Grid in the code behind 

A:

This is by design. The Validation.ErrorTemplate will be displayed on the adorner layer. Elements in the adorner layer are rendered on top of the rest of the visual elements and they will not be considered when the layout system is measuring and arranging the controls.
From MSDN: https://msdn.microsoft.com/en-us/library/system.windows.documents.adornerlayer(v=vs.110).aspx

Anything placed in the adorner layer is rendered on top of the rest of any styles you have set. In other words, adorners are always visually on top and cannot be overridden using z-order.

