New to Telerik UI for WinForms? Download free 30-day trial

Settings

XamlFormatProvider allows for import of XAML documents and respectively export of RadRichTextEditor 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 RadRichTextEditor 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.

Setting the ExportSettings of the XamlFormatProvider

XamlFormatProvider xamlFormatProvider = new XamlFormatProvider();
XamlExportSettings settings = new XamlExportSettings();
settings.ImageExportMode = ImageExportMode.UriSource;
xamlFormatProvider.ExportSettings = settings;

Dim xamlFormatProvider As XamlFormatProvider = New XamlFormatProvider()
Dim settings As XamlExportSettings = New XamlExportSettings()
settings.ImageExportMode = 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.

Setting the ImportSettings of the XamlFormatProvider

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

Dim xamlFormatProvider As XamlFormatProvider = New XamlFormatProvider()
Dim settings As XamlImportSettings = New XamlImportSettings()
xamlFormatProvider.ImportSettings = settings
AddHandler settings.ImageImported, AddressOf XamlImportSettings_ImageImported

ImageImported Event

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

Private Sub XamlImportSettings_ImageImported(ByVal sender As Object, ByVal e As ImageImportedEventArgs)
    Dim img = e.Image
End Sub

See Also

In this article