Table of Contents

Class SkiaRichLabel

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll

Will internally create spans from markdown. Spans property must not be set directly.

public class SkiaRichLabel : SkiaLabel, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, IHasAfterEffects, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ISkiaDisposable, IDisposable, ISkiaGestureListener, IText, ITextStyle
Inheritance
SkiaRichLabel
Implements
Derived
Inherited Members
Extension Methods

Constructors

SkiaRichLabel()

public SkiaRichLabel()

SkiaRichLabel(string)

public SkiaRichLabel(string text)

Parameters

text string

Fields

CodeBackgroundColorProperty

public static readonly BindableProperty CodeBackgroundColorProperty

Field Value

BindableProperty

CodeBlockBackgroundColorProperty

public static readonly BindableProperty CodeBlockBackgroundColorProperty

Field Value

BindableProperty

CodeTextColorProperty

public static readonly BindableProperty CodeTextColorProperty

Field Value

BindableProperty

ColorCode

public static Color ColorCode

Field Value

Color

ColorCodeBackground

public static Color ColorCodeBackground

Field Value

Color

ColorCodeBlock

public static Color ColorCodeBlock

Field Value

Color
public static Color ColorLink

Field Value

Color

ColorStrikeout

public static Color ColorStrikeout

Field Value

Color

CommandLinkTappedProperty

public static readonly BindableProperty CommandLinkTappedProperty

Field Value

BindableProperty

HeadingTextColorProperty

public static readonly BindableProperty HeadingTextColorProperty

Field Value

BindableProperty

LinkColorProperty

public static readonly BindableProperty LinkColorProperty

Field Value

BindableProperty

MaskPrefixBullet

public static string MaskPrefixBullet

Field Value

string

MaskPrefixNumbered

public static string MaskPrefixNumbered

Field Value

string

PrefixBulletProperty

public static readonly BindableProperty PrefixBulletProperty

Field Value

BindableProperty

PrefixNumberedProperty

public static readonly BindableProperty PrefixNumberedProperty

Field Value

BindableProperty

StrikeoutColorProperty

public static readonly BindableProperty StrikeoutColorProperty

Field Value

BindableProperty

UnderlineLinkProperty

public static readonly BindableProperty UnderlineLinkProperty

Field Value

BindableProperty

UnderlineWidthProperty

public static readonly BindableProperty UnderlineWidthProperty

Field Value

BindableProperty

hadParagraph

protected bool hadParagraph

Field Value

bool

isBold

protected bool isBold

Field Value

bool

isCodeBlock

protected bool isCodeBlock

Field Value

bool

isHeading1

protected bool isHeading1

Field Value

bool

isHeading2

protected bool isHeading2

Field Value

bool

isHeading3

protected bool isHeading3

Field Value

bool

isItalic

protected bool isItalic

Field Value

bool

isStrikethrough

protected bool isStrikethrough

Field Value

bool

standardSymbols

protected static HashSet<char> standardSymbols

Field Value

HashSet<char>

Properties

CodeBackgroundColor

public Color CodeBackgroundColor { get; set; }

Property Value

Color

CodeBlockBackgroundColor

public Color CodeBlockBackgroundColor { get; set; }

Property Value

Color

CodeTextColor

public Color CodeTextColor { get; set; }

Property Value

Color

CommandLinkTapped

public ICommand CommandLinkTapped { get; set; }

Property Value

ICommand

HeadingTextColor

public Color HeadingTextColor { get; set; }

Property Value

Color

LinkColor

public Color LinkColor { get; set; }

Property Value

Color

PrefixBullet

public string PrefixBullet { get; set; }

Property Value

string

PrefixNumbered

public string PrefixNumbered { get; set; }

Property Value

string

StrikeoutColor

public Color StrikeoutColor { get; set; }

Property Value

Color
public bool UnderlineLink { get; set; }

Property Value

bool

UnderlineWidth

Used for underlining text, in points. If you set it negative it will be in PIXELS instead of points. Default is -1 (1 pixel).

public double UnderlineWidth { get; set; }

Property Value

double

Methods

AddCodeSpan(Inline)

protected virtual void AddCodeSpan(Inline code)

Parameters

code Inline

AddLinkSpan(Inline)

protected virtual void AddLinkSpan(Inline link)

Parameters

link Inline

AddTextSpan(string, Action<TextSpan>)

protected virtual void AddTextSpan(string text, Action<TextSpan> modifySpan = null)

Parameters

text string
modifySpan Action<TextSpan>

CreateLineBreak()

Creates a line break inline element

protected virtual Inline CreateLineBreak()

Returns

Inline

CreateLiteral(string)

Creates a literal inline element with specified content

protected virtual Inline CreateLiteral(string content)

Parameters

content string

Returns

Inline

GetLinkLabelText(Inline)

protected virtual string GetLinkLabelText(Inline link)

Parameters

link Inline

Returns

string

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnLinkTapped(string, string)

public virtual void OnLinkTapped(string url, string text)

Parameters

url string
text string

OnSpanTapped(TextSpan)

Url will be inside Tag

public override ISkiaGestureListener OnSpanTapped(TextSpan span)

Parameters

span TextSpan

Returns

ISkiaGestureListener

ProcessSpanData(ref List<(string Text, SKTypeface Typeface, int Symbol, bool Shape)>, SKTypeface)

Do not let spans with non-default typeface end with standart symbols like ' ', move them to span with original typecase

protected virtual void ProcessSpanData(ref List<(string Text, SKTypeface Typeface, int Symbol, bool Shape)> spanData, SKTypeface originalTypeFace)

Parameters

spanData List<(string Text, SKTypeface Typeface, int Symbol, bool Shape)>
originalTypeFace SKTypeface

RenderBlock(Block, Inline)

Renders a markdown block element into text spans

protected void RenderBlock(Block block, Inline prefix = null)

Parameters

block Block
prefix Inline

RenderBlock(Inline)

protected void RenderBlock(Inline inline)

Parameters

inline Inline

RenderBulletListItem(Block)

protected void RenderBulletListItem(Block listItem)

Parameters

listItem Block

RenderInline(Inline)

protected void RenderInline(Inline inline)

Parameters

inline Inline

RenderOrderedListItem(Block, int)

protected void RenderOrderedListItem(Block listItem, int startNumber)

Parameters

listItem Block
startNumber int

SetTextInternal()

Aplies transforms etc

protected override void SetTextInternal()

SpanWithAttributes(TextSpan, FontAttributes)

Creates a text span with passed data.

protected virtual TextSpan SpanWithAttributes(TextSpan span, FontAttributes fontAttributes)

Parameters

span TextSpan

Data for span creation

fontAttributes FontAttributes

Force setting attributes

Returns

TextSpan

Events

LinkTapped

public event EventHandler<string> LinkTapped

Event Type

EventHandler<string>