title: Validated Textbox in a UserControl
body: <p>I have created a UserControl - a Labeled <code>TextBox</code> which is working pretty well, except for the validation template. When there's an error the validation control template shows up but it fills the whole space including the Label. I only want it to be as big as the <code>TextBox</code>. How to fix this?</p>
  
  <p>Here's the xaml:</p>
  
  <pre><code>&lt;UserControl x:Class="Infrastructure.CustomControls.LabelTextBox"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               x:Name="LTB"&gt;
  
      &lt;Grid HorizontalAlignment="{Binding}"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="Auto"/&gt;
              &lt;ColumnDefinition Width="*"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
          &lt;TextBlock x:Name="tbl" 
                     FontFamily="{Binding}" 
                     FontSize="{Binding}" 
                     Text="{Binding ElementName=LTB, Path=LabelText}" 
                     Height="{Binding ElementName=LTB, Path=LabelHeight}" 
                     Width="{Binding ElementName=LTB, Path=LabelWidth}" 
                     VerticalAlignment="Center"/&gt;
          &lt;TextBox x:Name="tbx" 
                   Grid.Column="1" 
                   FontFamily="{Binding}" 
                   FontSize="{Binding}" 
                   IsReadOnly="{Binding ElementName=LTB, Path=IsReadOnly}" 
                   MaxLength="{Binding ElementName=LTB, Path=TextMaxLength}" 
                   Text="{Binding ElementName=LTB, Path=Text}" 
                   Height="{Binding ElementName=LTB, Path=TextHeight}"
                   Width="{Binding ElementName=LTB, Path=TextWidth}" 
                   VerticalAlignment="Center"&gt;
              &lt;Validation.ErrorTemplate&gt;
                  &lt;ControlTemplate&gt;
                      &lt;DockPanel LastChildFill="True" 
                                 ToolTip="{Binding ElementName=aep, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"&gt;
                          &lt;TextBlock DockPanel.Dock="Right" 
                                     Foreground="Red" 
                                     FontSize="14pt" Text="*" 
                                     Margin="-15,0,0,0" 
                                     FontWeight="Bold"/&gt;
                          &lt;Border BorderBrush="Red" BorderThickness="1"&gt;
                              &lt;AdornedElementPlaceholder Name="aep"/&gt;
                          &lt;/Border&gt;
                      &lt;/DockPanel&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Validation.ErrorTemplate&gt;
          &lt;/TextBox&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>