Edit this page

Settings

XamlFormatProvider allows for import of XAML documents and respectively export of RadRichTextBox to XAML file. Additionally, the import/export settings provide modification options. The current article outlines the available settings.

Export Settings

XamlFormatProvider exposes ExportSettings, which allow you to control the export of the RadRichTextBox document.

Export Settings Properties

  • ImageExportMode: A property of type ImageExportMode that gets or sets how the image should be exported. This property is an enumeration and it allows the following values:
    • None: Images are not exported.
    • RawData: Images are exported using their RawData.
    • ImageExportingEvent: Event is fired on exporting.
    • UriSource: The UriSource property is used instead of RawData. Bare in mind that this property may not be set on all images.

Export Settings Events

  • ImageExporting: This event is fired every time before exporting an Image.
  • InlineUIContainerExporting: This event is fired every time before exporting an InlineUIContainer.

These events will be called when the ImageExportMode enumeration property is set to ImageExportingEvent.

[C#] Example 1: Setting the ExportSettings of the XamlFormatProvider

XamlFormatProvider xamlFormatProvider = new XamlFormatProvider();
XamlExportSettings settings = new XamlExportSettings();
settings.ImageExportMode = Telerik.Windows.Documents.FormatProviders.Xaml.ImageExportMode.UriSource;
xamlFormatProvider.ExportSettings = settings;

Import Settings

XamlFormatProvider exposes ImportSettings, which allow you to control the import of the XAML file.

Import Settings Events

  • ImageImported: This event is fired every time when the Image is imported.
  • InlineUIContainerImported: This event is fired every time when the InlineUIContainer is imported.

[C#] Example 2: Setting the ExportSettings of the XamlFormatProvider

XamlFormatProvider xamlFormatProvider = new XamlFormatProvider();
XamlImportSettings settings = new XamlImportSettings();
xamlFormatProvider.ImportSettings = settings;
settings.ImageImported += XamlImportSettings_ImageImported;

private void XamlImportSettings_ImageImported(object sender, ImageImportedEventArgs e)
{
    var img = e.Image;
}

See Also