Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
Importing and exporting to varaibles
posted

Hello,

I have a simple question that I cant seem to find the answer for..

I have a richtextdocument but how do I get the rtf document from that, I dont want to export to a file I just want the data to store against a variable.

I also need to be able to read the rtf document into the XamRichTextEditor control 

Something along the lines of:

RichTextDocument Document { get; set; }

..

// getting the rtf document

string rtf = Document.Rtf.Value; // or whatever it is so I can get the rft

// loading the rtf into the document

Document = rtf;

Thanks, Grant

  • 665
    Verified Answer
    posted

    I found the answer, by using the RtfDocumentAdapter class. 

    <ig:RtfDocumentAdapter Document="{Binding ElementName=RichTextEditor, Path=Document}" Value="{Binding RichText}" RefreshTrigger="ContentChanged" />
     
                <ig:XamRichTextEditor Grid.Column="0" Grid.Row="1" Name="RichTextEditor" BorderBrush="DarkGray" BorderThickness="1" >
     
                    <ig:XamRichTextEditor.ClipboardSerializationProviders>
                        <ig:RtfSerializationProvider />
                    </ig:XamRichTextEditor.ClipboardSerializationProviders>
     
                </ig:XamRichTextEditor>