New to Telerik UI for WinFormsStart a free 30-day trial

Using XamlFormatProvider

Updated on May 7, 2026

XamlFormatProvider makes it easy to import and export RadDocument to/from XAML format, preserving as much as possible of the document structure and formatting.

Since R2 2023 SP1 the XamlFormatProvider automatically verifies the imported XAML. More information is available in the Xaml Verification article.

To use XamlFormatProvider, you should reference the Telerik.WinControls.RichTextEditor.dll and add the following namespace:

  • Telerik.WinForms.Documents.FormatProviders.Xaml

Import

In order to import a XAML document you can use the overloads of the Import() method.

The first example shows how to use XamlFormatProvider to import XAML document from a file.

Import XAML Document from a File

C#
XamlFormatProvider xamlformatProvider = new XamlFormatProvider();
using (Stream stream = File.OpenRead(@"..\..\RichTextEditor\ImportExport\Sample.xaml"))
{
    this.radRichTextEditor1.Document = xamlformatProvider.Import(stream);
}

Export

In order to export a document to XAML, you need to use the Export() method of XamlFormatProvider.

This example shows how to use XamlFormatProvider to export RadDocument to a file.

Export Document to a File

C#
XamlFormatProvider provider = new XamlFormatProvider();
using (FileStream output = File.OpenWrite("Sample.xaml"))
{
    RadDocument document = this.radRichTextEditor1.Document;
    provider.Export(document, output);
}

See Also

In this article
ImportExportSee Also
Not finding the help you need?
Contact Support