# 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.

> note Since R2 2023 SP1 the XamlFormatProvider automatically verifies the imported XAML. More information is available in the [Xaml Verification](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/import-export/xaml/xaml-verification) article.

## 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**.

**Example 1: Setting the ExportSettings of the XamlFormatProvider**

```C#
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.
* **PreProcessingXaml**: This event is fired right before the XAML is parsed and allows you to check it for undesired content. The event arguments expose the following options:
  * **Xaml**: The XAML string that is being imported. You can changed it and then pass it again to the property so the changed XAML is imported.
  * **SkipXamlValidation**: Allows you to skip the default XAML types validation.

**Example 2: Disable the default XAML validation**

```C#

	XamlFormatProvider provider = new XamlFormatProvider();
        provider.ImportSettings.PreProcessingXaml += (s, args) => { 
    
        args.SkipXamlValidation = true;
    };

```

**Example 3: Setting the ExportSettings of the XamlFormatProvider**

```C#

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;
}

```

### Properties

* **AllowedAssemblies**: This collection contains the assemblies that contains the allowed types for the XAML import.

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/getting-started/getting-started)
* [Using XamlFormatProvider](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/import-export/plain-text/txt-txtformatprovider)
