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

Holds style, list-style, and document-list data that can be extracted from or applied to a document.

Definition

Namespace:Telerik.WinForms.Documents.Model.Styles

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class Stylesheet

Inheritance: objectStylesheet

Constructors

Creates an empty stylesheet with version 1.0 and initialized style and list collections.

C#
public Stylesheet()

Properties

Gets or sets the mappings between serialized document-list identifiers and their list styles.

C#
[XamlCompositePropertySerializable]
public List<ListSerializationData> Lists { get; set; }

Gets or sets the list-style definitions referenced by the serialized document lists.

C#
[XamlCompositePropertySerializable]
public List<ListStyle> ListStyles { get; set; }

Gets or sets the style definitions included in the stylesheet.

C#
[XamlCompositePropertySerializable]
public List<StyleDefinition> Styles { get; set; }

Gets or sets the stylesheet serialization version. New instances use version 1.0.

C#
[XamlSerializable]
public string Version { get; set; }

Methods

Copies all styles, list styles and other stylesheet data to the specified Document

C#
public void ApplyStylesheetToDocument(RadDocument document)
Parameters:documentRadDocument

The document that receives the stylesheet's styles and list data.

Suspends layout updates of RadRichtextBox, which has better performance and uses ApplyStylesheetToDocument(RadDocument) to apply the stylesheet.

C#
public void ApplyStylesheetToRichTextBox(RadRichTextBox richTextBox)
Parameters:richTextBoxRadRichTextBox

The rich-text box whose document receives the stylesheet.

Copies style definitions from a document, optionally limiting the copied styles with a predicate. Conditional table-style data is populated for the resulting definitions.

C#
protected virtual void CopyStylesFromDocument(RadDocument document, Func<StyleDefinition, bool> filter = null)
Parameters:documentRadDocument

The document whose styles are copied.

filterFunc<StyleDefinition, bool>

An optional predicate that selects styles to include.

Extracts style definitions and the list data needed to serialize lists used by the document. When customStylesOnly is true, only custom style definitions are included; list serialization data is still collected from the document.

C#
public void ExtractStylesheetFromDocument(RadDocument document, bool customStylesOnly = false)
Parameters:documentRadDocument

The document to extract from.

customStylesOnlybool

Whether to include only custom style definitions.