New to Telerik Document ProcessingStart a free 30-day trial

Manages the collection of styles in a document, supporting registration, retrieval, and default style tracking.

Definition

Namespace:Telerik.Windows.Documents.Flow.Model.Styles

Assembly:Telerik.Windows.Documents.Flow.dll

Syntax:

C#
public class StyleRepository

Inheritance: objectStyleRepository

Methods

Registers the specified style in the repository and associates it with this document.

C#
public void Add(Style style)
Parameters:styleStyle

The style.

Exceptions:

ArgumentNullException

style is part of another style repository.

Creates and registers a built-in style by its identifier; returns the newly added style. Use IDs from BuiltInStyleNames class.

C#
public Style AddBuiltInStyle(string styleId)
Parameters:styleIdstring

The ID of the built-in style.

Returns:

Style

The built-in style, added to the repository.

Exceptions:

ArgumentException

styleId is not an ID of a built-in style.

Unregisters all styles from the repository.

C#
public void Clear()

Checks whether a style with the specified identifier exists in the repository.

C#
public bool Contains(string styleId)
Parameters:styleIdstring

The style id.

Returns:

bool

true if styleId is found in the StyleRepository; otherwise, false.

Retrieves the default style for the specified style type, or null if none is registered.

C#
public Style GetDefaultStyle(StyleType type)
Parameters:typeStyleType

The type.

Returns:

Style

The default style or null if such is not present in the repository.

Retrieves the style with the specified identifier, or null if not found.

C#
public Style GetStyle(string styleId)
Parameters:styleIdstring

The style id.

Returns:

Style

The style with the given id or null if such is not present in the repository.

Unregisters the style with the specified identifier from the repository.

C#
public void Remove(string styleId)
Parameters:styleIdstring

The style id.

Unregisters the specified style from the repository.

C#
public void Remove(Style style)
Parameters:styleStyle

The style.

Properties

Gets the document that owns this style repository.

C#
public RadFlowDocument Document { get; }
Property Value:

The document.

Gets all styles currently registered in the repository.

C#
public IEnumerable<Style> Styles { get; }
Property Value:

The styles.