In WPF you can insert at the caret position using the CaretIndex
property. However this seems to be missing in the Silverlight textbox control.
Is it possible using a different technique?
I also had the same problem. I used the SelectionStart property.
private void QuotePrefixTextboxTextChanged(object sender, TextChangedEventArgs e)
{
var tb = (TextBox)sender;
var caret = tb.SelectionStart;
tb.Text = tb.Text.ToUpper();
tb.SelectionStart = caret;
}
Try:-
myTextBox.Select(position, 0);
myTextBox.SelectedText = "Content to insert";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With