title: Why does my TextBox with custom control template not have a visible text cursor?
body: <p>I have a custom control template which is set via the style property on a TextBox. The visual poperties are set correctly, even typing to the textbox works, but there is no insertion cursor (the | symbol) visible which makes editing challenging for our users.</p>
  
  <p>How does the control template need changing to get the traditional TextBox behavior back?</p>
  
  <pre><code>&lt;Style x:Key="DemandEditStyle" TargetType="TextBox"&gt;
      &lt;EventSetter Event="LostFocus" Handler="DemandLostFocus" /&gt;
      &lt;Setter Property="HorizontalAlignment" Value="Stretch" /&gt;
      &lt;Setter Property="VerticalAlignment" Value="Stretch" /&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate&gt;
                  &lt;Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="*" /&gt;
                          &lt;ColumnDefinition Width="1" /&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition Height="*" /&gt;
                          &lt;RowDefinition Height="1" /&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;Grid.Background&gt;
                          &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
                              &lt;GradientStop Color="White" Offset="0" /&gt;
                              &lt;GradientStop Color="White" Offset="0.15" /&gt;
                              &lt;GradientStop Color="#EEE" Offset="1" /&gt;
                          &lt;/LinearGradientBrush&gt;
                      &lt;/Grid.Background&gt;
                      &lt;Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Background="Black" /&gt;
                      &lt;Border Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Background="Black" /&gt;
                      &lt;Grid Grid.Row="0" Grid.Column="0" Margin="2"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="1" /&gt;
                              &lt;ColumnDefinition Width="*" /&gt;
                              &lt;ColumnDefinition Width="1" /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="1" /&gt;
                              &lt;RowDefinition Height="*" /&gt;
                              &lt;RowDefinition Height="1" /&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Background="Black" /&gt;
                          &lt;Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Background="Black" /&gt;
                          &lt;Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Background="#CCC" /&gt;
                          &lt;Border Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" Background="#CCC" /&gt;
                          &lt;TextBlock Grid.Row="1" Grid.Column="1"
                                 TextAlignment="Right" HorizontalAlignment="Center" VerticalAlignment="Center" 
                                 Padding="3 0 3 0" Background="Yellow"
                                 Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text}"
                                 Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}, AncestorLevel=1}, Path=ActualWidth}" /&gt;
                      &lt;/Grid&gt;
                  &lt;/Grid&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p><strong>Update:</strong> Replacing the inner-most TextBox with a ScrollViewer and naming it PART_ContentHost indeed shows the text insertion cursor.</p>