title: Set the caret/cursor position to the end of the string value WPF textbox
body: <p>I am try to set the caret/cursor position to the <strong>end</strong> of the string value in my WPF textbox when I open my window for the first time.  I use the FocusManager to set the focus on my textbox when my window opens.</p>
  
  <p>Nothing seems to work.  Any ideas?</p>
  
  <p>Note, I am using the MVVM pattern, and I included only a portion of the XAML from my code.</p>
  
  <pre><code>&lt;Window 
      FocusManager.FocusedElement="{Binding ElementName=NumberOfDigits}"
      Height="400" Width="800"&gt;
  
      &lt;Grid&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition/&gt;
              &lt;RowDefinition/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;TextBox Grid.Column="0" Grid.Row="0" 
                   x:Name="NumberOfDigits"
                   IsReadOnly="{Binding Path=IsRunning, Mode=TwoWay}"
                   VerticalContentAlignment="Center"
                   Text="{Binding Path=Digits, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt;
          &lt;Button Grid.Column="0" Grid.Row="1" 
                   Margin="10,0,10,0"
                   IsDefault="True"
                   Content="Start" 
                   Command="{Binding StartCommand}"/&gt;
      &lt;/Grid&gt;
   &lt;/Window&gt;
  </code></pre>