Reputation: 1004
How do I get the text out of a Silverlight 4 RichTextBox without the formatting? I know the Xaml property will give me the XAML but I just want the text.
Upvotes: 2
Views: 2391
Reputation: 4328
This is a little late, but I will post anyway. There is a trick that involves selecting all the text in code and then accessing the Text propety of the TextSelection object. Like so:
myRichTextBox.SelectAll();
var plainText = myRichTextBox.Selection.Text;
I am using it in my apps and although it is not the prettiest solution, it works. Found it here:
http://forums.silverlight.net/forums/p/184560/422007.aspx
Upvotes: 2
Reputation: 5360
There are various third-party components that support this kind of functionality (unfortunately paid). For example, Telerik's RadRichTextBox supports both highlighting and exporting rich text content as plain text, latter trough component called TxtFormatProvider.
Upvotes: 0