You can set the caret position using CaretIndex
property of a TextBox
. Please bear in mind that this is not a DependencyProperty
. Nevertheless, you may still set it in XAML like this:
<TextBox Text="123" CaretIndex="{x:Static System:Int32.MaxValue}" />
Please remember to set CaretIndex
after Text
property or else it will not work. Thus it probably won’t work if you bind to Text
like in your example. In that case, simply use code-behind like this.
NumberOfDigits.CaretIndex = NumberOfDigits.Text.Length;