Class
Span

Represents a span of text within a document, allowing for text formatting and structuring.

Definition

Namespace:Telerik.Windows.Documents.Model

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

cs-api-definition
public class Span : Inline

Inheritance: objectDocumentElementInlineSpan

Derived Classes: Break

Inherited Members Inline.CopyContentFrom(DocumentElement)Inline.FieldStartInline.IsCopyableDocumentElement.GetStyleProperty(IStylePropertyDefinition)DocumentElement.GetStyleProperty(string)DocumentElement.EnumerateChildrenOfType<T>()DocumentElement.GetParentOfType<T>()DocumentElement.CreateLayoutBox()DocumentElement.CopyPropertiesFrom(DocumentElement)DocumentElement.CopyPropertiesFromStyle(StyleDefinition)DocumentElement.ExtractStyleFromProperties()DocumentElement.ExtractStyleFromLocalProperties()DocumentElement.InvalidateAssociatedBoxesArrange()DocumentElement.InvalidateAssociatedBoxesMeasure()DocumentElement.InvalidateAssociatedBoxesLayout()DocumentElement.GetAssociatedLayoutBoxes()DocumentElement.GetRootDocument()DocumentElement.CreateDeepCopy()DocumentElement.CreateShallowCopy()DocumentElement.GetPropertyValueSource(IStylePropertyDefinition)DocumentElement.ClearValue(IStylePropertyDefinition)DocumentElement.OnRemoved()DocumentElement.OnStyleChanging()DocumentElement.OnStyleChanged()DocumentElement.OnStylePropertyChanged(StylePropertyChangeEventArgs)DocumentElement.OnParentChanging()DocumentElement.OnParentChanged()DocumentElement.ChildIndexDocumentElement.HasStyleDocumentElement.StyleDocumentElement.StyleNameDocumentElement.FirstLayoutBoxDocumentElement.IsFirstLayoutBoxInitializedDocumentElement.DocumentElementsDocumentElement.ParentDocumentElement.ChildrenDocumentElement.PreviousSiblingDocumentElement.NextSiblingDocumentElement.StyleChangingDocumentElement.StyleChangedDocumentElement.StylePropertyChangedDocumentElement.ParentChangingDocumentElement.ParentChangedDocumentElement.PropertyValueChanged

Constructors

Span()

Initializes a new instance of the Span class.

Declaration

cs-api-definition
public Span()

Span(Span)

Initializes a new instance of the Span class. Creates a copy of an existing Span.

Declaration

cs-api-definition
public Span(Span originalSpan)

Parameters

originalSpan

Span

The original span.

Span(string)

Initializes a new instance of the Span class with applied text.

Declaration

cs-api-definition
public Span(string text)

Parameters

text

string

The text content of the span.

Fields

BaselineAlignmentProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<BaselineAlignment?, SpanProperties> BaselineAlignmentProperty

Field Value

StylePropertyDefinition<BaselineAlignment?, SpanProperties>

FlowDirectionProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<FlowDirection?, SpanProperties> FlowDirectionProperty

Field Value

StylePropertyDefinition<FlowDirection?, SpanProperties>

FontFamilyProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<FontFamily, SpanProperties> FontFamilyProperty

Field Value

StylePropertyDefinition<FontFamily, SpanProperties>

FontSizeProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<double?, SpanProperties> FontSizeProperty

Field Value

StylePropertyDefinition<double?, SpanProperties>

FontStyleProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<FontStyle?, SpanProperties> FontStyleProperty

Field Value

StylePropertyDefinition<FontStyle?, SpanProperties>

FontWeightProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<FontWeight?, SpanProperties> FontWeightProperty

Field Value

StylePropertyDefinition<FontWeight?, SpanProperties>

ForeColorProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<Color?, SpanProperties> ForeColorProperty

Field Value

StylePropertyDefinition<Color?, SpanProperties>

HighlightColorProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<Color?, SpanProperties> HighlightColorProperty

Field Value

StylePropertyDefinition<Color?, SpanProperties>

StrikethroughProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<bool?, SpanProperties> StrikethroughProperty

Field Value

StylePropertyDefinition<bool?, SpanProperties>

TagProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<string, SpanProperties> TagProperty

Field Value

StylePropertyDefinition<string, SpanProperties>

ThemeFontFamilyProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<ThemeFontsEnum?, SpanProperties> ThemeFontFamilyProperty

Field Value

StylePropertyDefinition<ThemeFontsEnum?, SpanProperties>

ThemeForeColorProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<ThemeColorsEnum?, SpanProperties> ThemeForeColorProperty

Field Value

StylePropertyDefinition<ThemeColorsEnum?, SpanProperties>

ThemeForeColorShadeProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<string, SpanProperties> ThemeForeColorShadeProperty

Field Value

StylePropertyDefinition<string, SpanProperties>

ThemeForeColorTintProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<string, SpanProperties> ThemeForeColorTintProperty

Field Value

StylePropertyDefinition<string, SpanProperties>

ThemeUnderlineColorProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<ThemeColorsEnum?, SpanProperties> ThemeUnderlineColorProperty

Field Value

StylePropertyDefinition<ThemeColorsEnum?, SpanProperties>

ThemeUnderlineColorShadeProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<string, SpanProperties> ThemeUnderlineColorShadeProperty

Field Value

StylePropertyDefinition<string, SpanProperties>

ThemeUnderlineColorTintProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<string, SpanProperties> ThemeUnderlineColorTintProperty

Field Value

StylePropertyDefinition<string, SpanProperties>

UnderlineColorProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<Color?, SpanProperties> UnderlineColorProperty

Field Value

StylePropertyDefinition<Color?, SpanProperties>

UnderlineDecorationProperty

Declaration

cs-api-definition
public static readonly StylePropertyDefinition<IUnderlineUIDecorationProvider, SpanProperties> UnderlineDecorationProperty

Field Value

StylePropertyDefinition<IUnderlineUIDecorationProvider, SpanProperties>

Properties

BaselineAlignment

Gets or sets the baseline alignment.

Declaration

cs-api-definition
[XamlSerializable]
public BaselineAlignment BaselineAlignment { get; set; }

Property Value

BaselineAlignment

The baseline alignment.

Cursor

Gets or sets the cursor type depending on the specific element inside the span.

Declaration

cs-api-definition
public override Cursor Cursor { get; set; }

Property Value

Cursor

An instance of Cursor determining the cursor representation.

Overrides DocumentElement.Cursor

FlowDirection

Gets or sets the flow direction.

Declaration

cs-api-definition
[XamlSerializable]
public FlowDirection FlowDirection { get; set; }

Property Value

FlowDirection

The flow direction.

FontFamily

Gets or sets the font family of the content.

Declaration

cs-api-definition
[XamlSerializable]
public FontFamily FontFamily { get; set; }

Property Value

FontFamily

The font family.

FontSize

Gets or sets the size of the font. The value is in Device Independent Pixels.

Declaration

cs-api-definition
[XamlSerializable]
public double FontSize { get; set; }

Property Value

double

The size of the font.

FontStyle

Gets or sets the font style.

Declaration

cs-api-definition
[XamlSerializable]
public FontStyle FontStyle { get; set; }

Property Value

FontStyle

The font style.

FontWeight

Gets or sets the font weight.

Declaration

cs-api-definition
[XamlSerializable]
public FontWeight FontWeight { get; set; }

Property Value

FontWeight

The font weight.

ForeColor

Gets or sets the fore color.

Declaration

cs-api-definition
[XamlSerializable]
public Color ForeColor { get; set; }

Property Value

Color

The color.

HighlightColor

Gets or sets the color of the highlight.

Declaration

cs-api-definition
[XamlSerializable]
public Color HighlightColor { get; set; }

Property Value

Color

The color.

Strikethrough

Gets or sets a value indicating whether this Span has a strike-through applied.

Declaration

cs-api-definition
[XamlSerializable]
public bool Strikethrough { get; set; }

Property Value

bool

true if strike-through is applied; otherwise, false.

Tag

String property that allows developers to attach custom data to the DocumentElement. The value of this property will be copied to DocumentElements created out of this DocumentElement during editing.

Declaration

cs-api-definition
[XamlSerializable("")]
public override string Tag { get; set; }

Property Value

string

Overrides DocumentElement.Tag

Text

Gets or sets the text of the span.

Declaration

cs-api-definition
[XamlSerializable]
public string Text { get; set; }

Property Value

string

The text.

ThemeFontFamily

Gets or sets the theme font family.

Declaration

cs-api-definition
[XamlSerializable(ThemeFontsEnum.none)]
public ThemeFontsEnum ThemeFontFamily { get; set; }

Property Value

ThemeFontsEnum

The theme font family.

ThemeForeColor

Gets or sets the theme fore color.

Declaration

cs-api-definition
[XamlSerializable(ThemeColorsEnum.none)]
public ThemeColorsEnum ThemeForeColor { get; set; }

Property Value

ThemeColorsEnum

The color.

ThemeForeColorShade

Gets or sets the theme fore color shade.

Declaration

cs-api-definition
[XamlSerializable]
public string ThemeForeColorShade { get; set; }

Property Value

string

The theme fore color shade.

ThemeForeColorTint

Gets or sets the theme fore color tint.

Declaration

cs-api-definition
[XamlSerializable]
public string ThemeForeColorTint { get; set; }

Property Value

string

The theme fore color tint.

ThemeUnderlineColor

Gets or sets the theme color of the underline decoration.

Declaration

cs-api-definition
[XamlSerializable(ThemeColorsEnum.none)]
public ThemeColorsEnum ThemeUnderlineColor { get; set; }

Property Value

ThemeColorsEnum

The color.

ThemeUnderlineColorShade

Gets or sets the theme underline color shade.

Declaration

cs-api-definition
[XamlSerializable]
public string ThemeUnderlineColorShade { get; set; }

Property Value

string

The theme underline color shade.

ThemeUnderlineColorTint

Gets or sets the theme underline color tint.

Declaration

cs-api-definition
[XamlSerializable]
public string ThemeUnderlineColorTint { get; set; }

Property Value

string

The theme underline color tint.

Underline

Gets a value indicating whether this Span has underline applied to it.

Declaration

cs-api-definition
public bool Underline { get; }

Property Value

bool

true if the content is underlined; otherwise, false.

UnderlineColor

Gets or sets the color of the underline decoration.

Declaration

cs-api-definition
[XamlSerializable]
public Color UnderlineColor { get; set; }

Property Value

Color

The color.

UnderlineDecoration

Gets or sets the underline decoration.

Declaration

cs-api-definition
[XamlSerializable]
public IUnderlineUIDecorationProvider UnderlineDecoration { get; set; }

Property Value

IUnderlineUIDecorationProvider

The underline decoration.

Methods

AssociateBoxWithANewSpan(Span, SpanLayoutBox)

Associates the SpanLayoutBox with a new Span.

Declaration

cs-api-definition
public static bool AssociateBoxWithANewSpan(Span originalSpan, SpanLayoutBox spanLayoutBox)

Parameters

originalSpan

Span

The original span.

spanLayoutBox

SpanLayoutBox

The span layout box.

Returns

bool

true, if LayoutBox instances have been moved.

CalculateFinalFontSize()

Calculates the final size of the font depending on the BaselineAlignment value.

Declaration

cs-api-definition
public double CalculateFinalFontSize()

Returns

double

The calculated font size.

CopyContentFromOverride(DocumentElement)

Copies the content of a Span instance to the current object.

Declaration

cs-api-definition
protected override void CopyContentFromOverride(DocumentElement fromElement)

Parameters

fromElement

DocumentElement

The Span to copy the content from.

Overrides Inline.CopyContentFromOverride(DocumentElement)

CopyFromPositionToEndOfInline(DocumentPosition, DocumentPosition)

Creates a new span which is a copy of the contents between two positions of the current Span instance.

Declaration

cs-api-definition
public override Inline CopyFromPositionToEndOfInline(DocumentPosition documentPosition, DocumentPosition endPosition)

Parameters

documentPosition

DocumentPosition

The start position.

endPosition

DocumentPosition

The end position.

Returns

Inline

A new Span instance keeping the content between the specified positions.

Overrides Inline.CopyFromPositionToEndOfInline(DocumentPosition, DocumentPosition)

CopyFromStartOfInlineToEndPosition(DocumentPosition)

Creates a new span which is a copy of the contents between the start of the current instance and a specified end position.

Declaration

cs-api-definition
public override Inline CopyFromStartOfInlineToEndPosition(DocumentPosition endPosition)

Parameters

endPosition

DocumentPosition

The end position.

Returns

Inline

A new Span instance keeping the contents between the start of the current instance and a specified end position.

Overrides Inline.CopyFromStartOfInlineToEndPosition(DocumentPosition)

CopyPropertiesFromOverride(DocumentElement)

Copies the properties of a Span instance to the current object.

Declaration

cs-api-definition
protected override void CopyPropertiesFromOverride(DocumentElement fromElement)

Parameters

fromElement

DocumentElement

The Span to copy the properties from.

Overrides Inline.CopyPropertiesFromOverride(DocumentElement)

CreateLayoutBox(DocumentStructureCollection)

Creates a new SpanLayoutBox instance.

Declaration

cs-api-definition
public override LayoutBox CreateLayoutBox(DocumentStructureCollection documentCollection)

Parameters

documentCollection

DocumentStructureCollection

The document collection.

Returns

LayoutBox

The new SpanLayoutBox instance.

Overrides DocumentElement.CreateLayoutBox(DocumentStructureCollection)

CreateNewElementInstance()

Creates a new Span instance.

Declaration

cs-api-definition
protected override DocumentElement CreateNewElementInstance()

Returns

DocumentElement

The new Span instance.

Overrides DocumentElement.CreateNewElementInstance()

HasSameStyle(Span, bool, bool)

Determines whether a Span instance has the same style applied as the current one.

Declaration

cs-api-definition
public virtual bool HasSameStyle(Span other, bool compareFlowDirection = false, bool ignoreStyle = false)

Parameters

other

Span

The other.

compareFlowDirection

bool

if set to true the FlowDirection is compared as well.

ignoreStyle

bool

if set to true the name of the style applied to the spans is not compared.

Returns

bool

true if the current instance and the one passed as a parameter have the same style applied; otherwise, false.