Table of Contents

Class ResourceDictionaryImporter

Namespace
Icy.Markup
Assembly
IcyUI.dll

Loads a standalone ResourceDictionary document through the asset pipeline, so a shared or themed dictionary file can be requested by path like any other asset - what <ResourceDictionary Source="Themes/Default.xml"/> does when it appears under MergedDictionaries.

public class ResourceDictionaryImporter : IAssetImporter<ResourceDictionary>, IFormatReadChecker
Inheritance
ResourceDictionaryImporter
Implements
Inherited Members
Extension Methods

Remarks

Register it with AddMarkupSupport(IConfigurationBuilder), alongside MarkupImporter - the two importers share one MarkupLoader, differing only in which root type each requires the document to declare.

Each import produces a fresh dictionary, for the same reason MarkupImporter produces a fresh tree: two loads of the same file must not share one mutable instance.

Constructors

ResourceDictionaryImporter(IcyConfiguration)

Loads a standalone ResourceDictionary document through the asset pipeline, so a shared or themed dictionary file can be requested by path like any other asset - what <ResourceDictionary Source="Themes/Default.xml"/> does when it appears under MergedDictionaries.

public ResourceDictionaryImporter(IcyConfiguration configuration)

Parameters

configuration IcyConfiguration

The configuration whose markup, conversion, and property services are used.

Remarks

Register it with AddMarkupSupport(IConfigurationBuilder), alongside MarkupImporter - the two importers share one MarkupLoader, differing only in which root type each requires the document to declare.

Each import produces a fresh dictionary, for the same reason MarkupImporter produces a fresh tree: two loads of the same file must not share one mutable instance.

Fields

MarkupMimeType

The MIME type markup documents are served as.

public const string MarkupMimeType = "application/xml"

Field Value

string

TextMarkupMimeType

The alternative MIME type XML files are commonly reported as.

public const string TextMarkupMimeType = "text/xml"

Field Value

string

Methods

CanRead(string?)

Checks if the importer can read assets in the specified data format.

public bool CanRead(string? format)

Parameters

format string

A string with MIME-type for the format of the loaded asset.

Returns

bool

true if the asset can be loaded by this asset reader; otherwise false.

Import(Stream, IImportContext)

Performs asset loading from the specified data stream.

public ResourceDictionary Import(Stream stream, IImportContext importContext)

Parameters

stream Stream

Data stream to read asset from.

importContext IImportContext

Context to import the asset.

Returns

ResourceDictionary

An instance of the asset of type ResourceDictionary loaded from the specified stream.

Exceptions

MarkupException

The document is malformed, breaks a rule of the language, or its root is not a ResourceDictionary.