Jeevan Bhatt
Jeevan Bhatt

Reputation: 6101

how to set RTF from WinForms to WPF RichTextBox

how to set RTF from WinForms to WPF RichTextBox. (Not by TextRange.Load()).

I have a string variable which has rtf text. I want to set this variable to wpf ritch text box.

Upvotes: 1

Views: 991

Answers (1)

Jeevan Bhatt
Jeevan Bhatt

Reputation: 6101

I got the solution.

MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text));
ritchTextBox.Selection.Load(stream, DataFormats.Rtf);

Upvotes: 1

Related Questions