Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Setting TextBox.SelectedText property
2 replies. Latest Post by Sergey Volk MSFT on April 25, 2008.
(0)
Bigsby
Member
262 points
81 Posts
04-11-2008 9:22 AM |
I already refered to this in another thread but I think this should have its own proper care.
What happens is that when TextBox.SelectedText property is set the rest of the text in the TextBox is cleared and the only remaining text is the text set to be the SelectedText and even so not selected.
Some thing like this:
TextBox tb = new TextBox;
tb.Text = "This is the text in the TextBox";
tb.SelectedText = "Selected Text";
After this code tb.Text whoud be only "Selected Text" with no selection.
04-17-2008 4:22 AM |
No news about this?
Sergey V...
Participant
788 points
98 Posts
04-25-2008 10:29 PM |
I don't think it's a bug. I have just tried this:
LayoutRoot.Children.Add(tb);
tb.SelectionStart = 12;
tb.SelectionLength = 4;
tb.SelectedText =
And it works as expected (textbox contains "This is the abc in the TextBox"). Have you tried setting SelectionStart / SelectionLength before setting SelectedText?