Table of Contents

Class SkiaEditor

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll
public class SkiaEditor : SkiaShape, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, IHasAfterEffects, ISkiaDisposable, ISkiaGridLayout, ISkiaLayout, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ILayoutInsideViewport, IInsideViewport, IVisibilityAware, IDisposable, ISkiaGestureListener
Inheritance
SkiaEditor
Implements
Inherited Members
Extension Methods

Constructors

SkiaEditor()

public SkiaEditor()

Fields

ActionDone

public static string ActionDone

Field Value

string

ActionGo

public static string ActionGo

Field Value

string

ActionNext

public static string ActionNext

Field Value

string

ActionSearch

public static string ActionSearch

Field Value

string

ActionSend

public static string ActionSend

Field Value

string

CanShowCursorProperty

public static readonly BindableProperty CanShowCursorProperty

Field Value

BindableProperty

CommandOnFocusChangedProperty

public static readonly BindableProperty CommandOnFocusChangedProperty

Field Value

BindableProperty

CommandOnSubmitProperty

public static readonly BindableProperty CommandOnSubmitProperty

Field Value

BindableProperty

CommandOnTextChangedProperty

public static readonly BindableProperty CommandOnTextChangedProperty

Field Value

BindableProperty

CursorColorProperty

public static readonly BindableProperty CursorColorProperty

Field Value

BindableProperty

CursorGradientProperty

public static readonly BindableProperty CursorGradientProperty

Field Value

BindableProperty

CursorPositionProperty

public static readonly BindableProperty CursorPositionProperty

Field Value

BindableProperty

FontFamilyProperty

public static readonly BindableProperty FontFamilyProperty

Field Value

BindableProperty

FontSizeProperty

public static readonly BindableProperty FontSizeProperty

Field Value

BindableProperty

FontWeightProperty

public static readonly BindableProperty FontWeightProperty

Field Value

BindableProperty

HorizontalTextAlignmentProperty

public static readonly BindableProperty HorizontalTextAlignmentProperty

Field Value

BindableProperty

IsFocusedProperty

public static readonly BindableProperty IsFocusedProperty

Field Value

BindableProperty

IsPasswordProperty

public static readonly BindableProperty IsPasswordProperty

Field Value

BindableProperty

KeyboardTypeProperty

public static readonly BindableProperty KeyboardTypeProperty

Field Value

BindableProperty

LineHeightProperty

public static readonly BindableProperty LineHeightProperty

Field Value

BindableProperty

MaxLinesProperty

public static readonly BindableProperty MaxLinesProperty

Field Value

BindableProperty

ParagraphBreakChar

protected const char ParagraphBreakChar = '\n'

Field Value

char

PlaceholderColorProperty

public static readonly BindableProperty PlaceholderColorProperty

Field Value

BindableProperty

PlaceholderHorizontalAlignmentProperty

public static readonly BindableProperty PlaceholderHorizontalAlignmentProperty

Field Value

BindableProperty

PlaceholderTextProperty

public static readonly BindableProperty PlaceholderTextProperty

Field Value

BindableProperty

ReturnTypeProperty

public static readonly BindableProperty ReturnTypeProperty

Field Value

BindableProperty

SelectionColorProperty

public static readonly BindableProperty SelectionColorProperty

Field Value

BindableProperty

SelectionLengthProperty

public static readonly BindableProperty SelectionLengthProperty

Field Value

BindableProperty

SoftLineBreakChar

protected const char SoftLineBreakChar = '\u2028'

Field Value

char

TextColorProperty

public static readonly BindableProperty TextColorProperty

Field Value

BindableProperty

TextGradientProperty

public static readonly BindableProperty TextGradientProperty

Field Value

BindableProperty

TextProperty

public static readonly BindableProperty TextProperty

Field Value

BindableProperty

TimerUpdateParentCursorPosition

protected RestartingTimer<int> TimerUpdateParentCursorPosition

Field Value

RestartingTimer<int>

UseMarkdownProperty

public static readonly BindableProperty UseMarkdownProperty

Field Value

BindableProperty

VerticalTextAlignmentProperty

public static readonly BindableProperty VerticalTextAlignmentProperty

Field Value

BindableProperty

_contentLayer

protected SkiaLayout _contentLayer

Field Value

SkiaLayout

_placeholderLabel

protected SkiaLabel _placeholderLabel

Field Value

SkiaLabel

_scroll

protected SkiaScroll _scroll

Field Value

SkiaScroll

_selectionControl

protected SkiaEditorSelection _selectionControl

Field Value

SkiaEditorSelection

_suppressImmediateCursorMove

Sets native control cursor position to CursorPosition (and selection end if active) and calls UpdateCursorVisibility.

protected bool _suppressImmediateCursorMove

Field Value

bool

Properties

CanShowCursor

public bool CanShowCursor { get; set; }

Property Value

bool

CommandOnFocusChanged

public ICommand CommandOnFocusChanged { get; set; }

Property Value

ICommand

CommandOnSubmit

public ICommand CommandOnSubmit { get; set; }

Property Value

ICommand

CommandOnTextChanged

public ICommand CommandOnTextChanged { get; set; }

Property Value

ICommand

Cursor

public SkiaCursor Cursor { get; protected set; }

Property Value

SkiaCursor

CursorColor

public Color CursorColor { get; set; }

Property Value

Color

CursorGradient

public SkiaGradient CursorGradient { get; set; }

Property Value

SkiaGradient

CursorPosition

public int CursorPosition { get; set; }

Property Value

int

FontFamily

public string FontFamily { get; set; }

Property Value

string

FontSize

public double FontSize { get; set; }

Property Value

double

FontWeight

public int FontWeight { get; set; }

Property Value

int

HorizontalTextAlignment

public DrawTextAlignment HorizontalTextAlignment { get; set; }

Property Value

DrawTextAlignment

IsFocused

public bool IsFocused { get; set; }

Property Value

bool

IsMultiline

public bool IsMultiline { get; }

Property Value

bool

IsPassword

public bool IsPassword { get; set; }

Property Value

bool

KeyboardType

public SkiaEditor.SkiaEditorKeyboard KeyboardType { get; set; }

Property Value

SkiaEditor.SkiaEditorKeyboard

Label

public SkiaLabel Label { get; protected set; }

Property Value

SkiaLabel

LineHeight

public double LineHeight { get; set; }

Property Value

double

MaxLines

public int MaxLines { get; set; }

Property Value

int

PlaceholderColor

public Color PlaceholderColor { get; set; }

Property Value

Color

PlaceholderHorizontalAlignment

public DrawTextAlignment PlaceholderHorizontalAlignment { get; set; }

Property Value

DrawTextAlignment

PlaceholderText

public string PlaceholderText { get; set; }

Property Value

string

ReturnType

public ReturnType ReturnType { get; set; }

Property Value

ReturnType

SelectionColor

public Color SelectionColor { get; set; }

Property Value

Color

SelectionLength

public int SelectionLength { get; set; }

Property Value

int

Text

public string Text { get; set; }

Property Value

string

TextColor

public Color TextColor { get; set; }

Property Value

Color

TextGradient

public SkiaGradient TextGradient { get; set; }

Property Value

SkiaGradient

UseMarkdown

public bool UseMarkdown { get; set; }

Property Value

bool

VerticalTextAlignment

public TextAlignment VerticalTextAlignment { get; set; }

Property Value

TextAlignment

WillClipBounds

Used to check whether to apply IsClippedToBounds property

public override bool WillClipBounds { get; }

Property Value

bool

Methods

ApplyKeyboardType()

public void ApplyKeyboardType()

CopySelection()

public void CopySelection()

CreateControl()

public virtual void CreateControl()

CreateCursor()

protected virtual SkiaCursor CreateCursor()

Returns

SkiaCursor

CreateLabel()

public virtual SkiaLabel CreateLabel()

Returns

SkiaLabel

CreatePlaceholderLabel()

protected virtual SkiaLabel CreatePlaceholderLabel()

Returns

SkiaLabel

CutSelection()

public void CutSelection()

DeleteSelection()

public void DeleteSelection()

DisposePlatform()

public void DisposePlatform()

ExecuteSubmit(bool)

protected void ExecuteSubmit(bool clearFocus)

Parameters

clearFocus bool

GetContentSizeForAutosizeInPixels()

Override this if you need to adjust the measured ContentSize for the parent to adapt to it. For example SkiaShape overrides this to expand by adding the needed size for stroke.

protected override SKSize GetContentSizeForAutosizeInPixels()

Returns

SKSize

GetCursorLine()

Returns the zero-based line index the cursor is currently on.

public int GetCursorLine()

Returns

int

GetCursorPosition(float, float)

Input in pixels

protected int GetCursorPosition(float x, float y)

Parameters

x float
y float

Returns

int

GetEditorBreakText(bool)

protected static string GetEditorBreakText(bool splitLine)

Parameters

splitLine bool

Returns

string

GetLineGlyphs(TextLine)

Returns all glyphs for a rendered line, flattened across spans. Override in subclasses to support multi-span lines.

protected virtual LineGlyph[] GetLineGlyphs(TextLine line)

Parameters

line TextLine

Returns

LineGlyph[]

GetSelectedText()

public string GetSelectedText()

Returns

string

GetWordBoundaries(int)

protected (int start, int end) GetWordBoundaries(int charIndex)

Parameters

charIndex int

Returns

(int start, int end)

HandleVerticalArrow(bool)

protected virtual void HandleVerticalArrow(bool up)

Parameters

up bool

InsertAtCursor(string)

public void InsertAtCursor(string value)

Parameters

value string

IsEditorBreak(char)

protected static bool IsEditorBreak(char value)

Parameters

value char

Returns

bool

IsTrailingEditorBreak(string)

protected static bool IsTrailingEditorBreak(string value)

Parameters

value string

Returns

bool

MoveCursorTo(double, double)

Translate cursor from the left top corner, params in pts.

protected virtual void MoveCursorTo(double x, double y)

Parameters

x double
y double

MoveInternalCursor()

protected void MoveInternalCursor()

NormalizeEditorLineBreaks(string?)

protected static string NormalizeEditorLineBreaks(string? value)

Parameters

value string

Returns

string

OnControlCreated()

protected virtual void OnControlCreated()

OnCreatingLabel(SkiaLabel)

protected virtual SkiaLabel OnCreatingLabel(SkiaLabel label)

Parameters

label SkiaLabel

Returns

SkiaLabel

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnFocusChanged(bool)

This will be called only for views registered at Superview.FocusedChild. The view must return true of false to indicate if it accepts focus.

public override bool OnFocusChanged(bool focus)

Parameters

focus bool

Returns

bool

OnLayoutChanged()

DrawingRect size changed

protected override void OnLayoutChanged()

OnMeasuring(float, float, float)

If you call this while measurement is in process (IsMeasuring==True) will return last measured value.

public override ScaledSize OnMeasuring(float widthConstraint, float heightConstraint, float scale)

Parameters

widthConstraint float
heightConstraint float
scale float

Returns

ScaledSize

OnWillDisposeWithChildren()

The OnDisposing might come with a delay to avoid disposing resources at use. This method will be called without delay when Dispose() is invoked. Disposed will set to True and for Views their OnWillDisposeWithChildren will be called.

public override void OnWillDisposeWithChildren()

Paint(DrawingContext)

This is the main drawing routine you should override to draw something. Base one paints background color inside DrawingRect that was defined by Arrange inside base.Draw. Pass arguments if you want to use some time-frozen data for painting at any time from any thread..

protected override void Paint(DrawingContext ctx)

Parameters

ctx DrawingContext

PasteFromClipboard()

public void PasteFromClipboard()

ProcessGestures(SkiaGesturesParameters, GestureEventProcessingInfo)

public override ISkiaGestureListener ProcessGestures(SkiaGesturesParameters args, GestureEventProcessingInfo apply)

Parameters

args SkiaGesturesParameters
apply GestureEventProcessingInfo

Returns

ISkiaGestureListener

ReplaceEditorBreaksWithSpaces(string)

protected static string ReplaceEditorBreaksWithSpaces(string value)

Parameters

value string

Returns

string

SelectAll()

public void SelectAll()

SelectWord(int)

public virtual void SelectWord(int charIndex)

Parameters

charIndex int

SetCursorPositionNative(int, int)

public void SetCursorPositionNative(int position, int stop = -1)

Parameters

position int
stop int

SetCursorPositionWithDelay(int, int)

We have to sync with a delay after text was changed otherwise the cursor position is not updated yet. Using restarting timer, every time this is called the timer is reset if callback wasn't executed yet.

protected void SetCursorPositionWithDelay(int ms, int position)

Parameters

ms int
position int

SetCursorVisible(bool)

protected void SetCursorVisible(bool show)

Parameters

show bool

SetFocus(bool)

public void SetFocus(bool focus)

Parameters

focus bool

SetFocusInternal(bool)

protected void SetFocusInternal(bool value)

Parameters

value bool

SetFocusNative(bool)

public void SetFocusNative(bool focus)

Parameters

focus bool

SetSelection(int, int)

public virtual void SetSelection(int start, int end)

Parameters

start int
end int

Submit()

This is Done or Enter key, so maybe just split lines in specific case

public void Submit()

UpdateCursorVisibility()

Positions cursor control where it should be using translation, and sets its visibility.

public virtual void UpdateCursorVisibility()

UpdateLabel()

public virtual void UpdateLabel()

UpdateNativePosition()

public void UpdateNativePosition()

UpdatePlaceholder()

protected virtual void UpdatePlaceholder()

Events

FocusChanged

public event EventHandler<bool> FocusChanged

Event Type

EventHandler<bool>

TextChanged

public event EventHandler<string> TextChanged

Event Type

EventHandler<string>

TextSubmitted

public event EventHandler<string> TextSubmitted

Event Type

EventHandler<string>