Keith Adler
Keith Adler

Reputation: 21178

Get text value in a RadRichTextBox

I have a RadRichTextBox in my Silverlight project which is setup to use basic formatting. Quite frankly I am just using it instead of Textbox in order to take advantage of the Spellchecker feature.

<telerik:RadRichTextBox AllowScaling="False" DocumentInheritsDefaultStyleSettings="True" Height="82" HorizontalAlignment="Left" HorizontalScrollBarVisibility="Hidden" IsContextMenuEnabled="True" IsSelectionMiniToolBarEnabled="False" IsSpellCheckingEnabled="True" Margin="32,61,0,0" Name="radRichTextBox1" VerticalAlignment="Top" VerticalScrollBarVisibility="Hidden" Width="202" />

How would I access the contents of radRichTextBox1 as just text with newlines?

Upvotes: 1

Views: 2710

Answers (1)

Keith Adler
Keith Adler

Reputation: 21178

The solution is to simply create a provider and extract the contents as follows:

var provider = new TxtFormatProvider();
var result = provider.Export(radRichTextBox1.Document);

Upvotes: 4

Related Questions