How to display XAML documents exported from RichTextBox in FlowDocumentReader?

2 posts, 0 answers
  1. Dean K.
    Dean K. avatar
    55 posts
    Member since:
    Aug 2011

    Posted 22 Aug 2013 Link to this post

    When a document is exported from RichTextBox into XAML it cannot be displayed in FlowDocumentReader control.

    I looked at the exported XAML and the root element is <t:RadDocument>. This cannot be displayed in FlowDocumentReader control. I tried enclosing this within <FlowDocument> element but that did not help...

    Anyway, how do I display XAML document exported by RichTextBox in FlowDocumentReader control? Or can this XAML genarated by RichTextBox only be displayed by the Telerik RadRichTextBox control?
  2. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 27 Aug 2013 Link to this post

    Hello Dean,

    Thank you for contacting us about this issue!

    You can export RadRichTextBox Document to FlowDocument by adding reference to Telerik.Windows.Documents.FormatProviders.MsRichTextBox.Xaml.dll and using an instance of MsRichTextBoxXamlFormatProvider. The following code snippet shows how exactly you can achieve that:

    MsRichTextBoxXamlFormatProvider xamlProvider = new MsRichTextBoxXamlFormatProvider();
    System.Windows.Documents.FlowDocument flowDocument = xamlProvider.ExportToFlowDocument(this.radRichTextBox.Document);

    I hope this helps! If you have any other questions or concerns please do not hesitate to contact us again!

    Regards,
    Deyan
    the Telerik team
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top