In This Article

ITextView Interface

Provides the base requirements for a text view.

public interface ITextView

Properties

CollapsedRegionManager

An ICollapsedRegionManager that provides information about collapsed regions in the view.

ICollapsedRegionManager? CollapsedRegionManager { get; }

Property Value

ICollapsedRegionManager

CurrentSnapshot

The ITextSnapshot that currently is used to populate the view.

ITextSnapshot CurrentSnapshot { get; }

Property Value

ITextSnapshot

DefaultBackgroundColor

The default background color.

Color DefaultBackgroundColor { get; }

Property Value

Color

DefaultCharacterWidth

The width of an average default font character in the view.

int DefaultCharacterWidth { get; }

Property Value

int

DefaultFontFamilyName

The default font family name.

string DefaultFontFamilyName { get; }

Property Value

string

DefaultFontSize

The default font size.

float DefaultFontSize { get; }

Property Value

float

DefaultForegroundColor

The default foreground color.

Color DefaultForegroundColor { get; }

Property Value

Color

DefaultLineHeight

The default line height.

int DefaultLineHeight { get; }

Property Value

int

DefaultSpaceWidth

The width of a default font space character in the view.

int DefaultSpaceWidth { get; }

Property Value

int

HighlightingStyleRegistry

The IHighlightingStyleRegistry used by this view.

IHighlightingStyleRegistry HighlightingStyleRegistry { get; }

Property Value

IHighlightingStyleRegistry

IsDefaultBackgroundColorLight

Indicates whether the default background color of the editor is light.

bool IsDefaultBackgroundColorLight { get; }

Property Value

bool:

true if the background color of the editor is light; otherwise, false.

IsWhitespaceVisible

Indicates whether whitespace (spaces and tabs) is visible.

bool IsWhitespaceVisible { get; }

Property Value

bool:

true if whitespace (spaces and tabs) is visible; otherwise, false.

Properties

The dictionary containing custom properties for this object.

PropertyDictionary Properties { get; }

Property Value

PropertyDictionary

ScrollState

The view's current scroll state.

TextViewScrollState ScrollState { get; }

Property Value

TextViewScrollState

SyntaxEditor

The SyntaxEditor that contains the view.

SyntaxEditor SyntaxEditor { get; }

Property Value

SyntaxEditor

TextAreaPadding

The padding thickness around the text area content.

Padding TextAreaPadding { get; }

Property Value

Padding

TextAreaSize

The size of the text area in text area coordinates.

Size TextAreaSize { get; }

Property Value

Size

TextAreaViewportBounds

A Rectangle indicating the bounds of visible portion of the text area, relative to view coordinates.

Rectangle TextAreaViewportBounds { get; }

Property Value

Rectangle

UniqueId

The Guid that uniquely identifies the view.

Guid UniqueId { get; }

Property Value

Guid

VisibleViewLines

The collection of ITextViewLine objects that are currently visible within the view.

ITextViewLineCollection VisibleViewLines { get; }

Property Value

ITextViewLineCollection

Remarks

The ITextViewLine items in this collection are sorted in their display order, top to bottom.

VisualElement

The IUIElement that represents the view.

IUIElement VisualElement { get; }

Property Value

IUIElement

ZoomLevel

A percentage value indicating the zoom level.

int ZoomLevel { get; }

Property Value

int:

The default value is 1.0, meaning 100%.

Methods

CreateTagAggregator<T>()

Creates a new ITagAggregator<T> that collects the tag results from all ITagger<T> instances associated with this view.

ITagAggregator<T> CreateTagAggregator<T>() where T : ITag
Type Parameters:
T -

The type of ITag associated with this aggregator.

Returns

ITagAggregator<T>

GetAdornmentLayer(AdornmentLayerDefinition)

Returns an IAdornmentLayer for the view with the specified definition.

IAdornmentLayer GetAdornmentLayer(AdornmentLayerDefinition layerDefinition)
Parameter Type Description
layerDefinition AdornmentLayerDefinition

The layer definition.

Returns

IAdornmentLayer

Remarks

If no IAdornmentLayer already exists with the specified name, one is created.

GetViewLine(TextPosition)

Returns an ITextViewLine that contains the specified TextPosition.

ITextViewLine GetViewLine(TextPosition position)
Parameter Type Description
position TextPosition

The TextPosition for which to retrieve an ITextViewLine.

Returns

ITextViewLine

GetViewLine(ITextViewLine, int, bool)

Returns the ITextViewLine that is relative to the specified ITextViewLine.

ITextViewLine GetViewLine(ITextViewLine viewLine, int lineDelta, bool forceVirtualSpace = false)
Parameter Type Description
viewLine ITextViewLine

The source ITextViewLine.

lineDelta int

The number of lines to traverse (can be negative).

forceVirtualSpace bool

Whether to force virtual line space to be used as needed (for block selections). The default value is false.

Returns

ITextViewLine

GetViewLine(int, bool)

Returns an ITextViewLine that contains the specified offset.

ITextViewLine GetViewLine(int offset, bool hasFarAffinity = false)
Parameter Type Description
offset int

The offset for which to retrieve an ITextViewLine.

hasFarAffinity bool

Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line. The default value is false.

Returns

ITextViewLine

InvalidateRender()

Invalidates and repaints the view's canvas.

void InvalidateRender()

OffsetToPosition(int)

Returns the TextPosition that represents the specified offset within the view lines.

TextPosition OffsetToPosition(int offset)
Parameter Type Description
offset int

The offset of a character within the document.

Returns

TextPosition

PerformLayout()

Ensures that the text area is updated with arranged view lines based on the current viewport size and scroll state.

void PerformLayout()

PositionToOffset(TextPosition)

Returns the offset for the specified TextPosition within the view lines.

int PositionToOffset(TextPosition position)
Parameter Type Description
position TextPosition

The TextPosition of a character within the view lines.

Returns

int

TransformFromTextArea(Point)

Transforms the specified Point in text area-relative coordinates to view-relative coordinates.

Point TransformFromTextArea(Point location)
Parameter Type Description
location Point

The Point to transform.

Returns

Point:

The transformed Point.

TransformFromTextArea(Rectangle)

Transforms the specified Rectangle in text area-relative coordinates to view-relative coordinates.

Rectangle TransformFromTextArea(Rectangle bounds)
Parameter Type Description
bounds Rectangle

The Rectangle to transform.

Returns

Rectangle:

The transformed Rectangle.

TransformToTextArea(Point)

Transforms the specified Point in view-relative coordinates to text area-relative coordinates.

Point TransformToTextArea(Point location)
Parameter Type Description
location Point

The Point to transform.

Returns

Point:

The transformed Point.

TransformToTextArea(Rectangle)

Transforms the specified Rectangle in view-relative coordinates to text area-relative coordinates.

Rectangle TransformToTextArea(Rectangle bounds)
Parameter Type Description
bounds Rectangle

The Rectangle to transform.

Returns

Rectangle:

The transformed Rectangle.

Events

Closed

Occurs when the view is closed.

event EventHandler Closed

Event Type

EventHandler

MarginsDestroyed

Occurs when the view's margins need to be destroyed.

event EventHandler MarginsDestroyed

Event Type

EventHandler

TextAreaLayout

Occurs when the layout of the lines in the text area has been updated.

event EventHandler<TextViewTextAreaLayoutEventArgs> TextAreaLayout

Event Type

EventHandler<TextViewTextAreaLayoutEventArgs>

Extension Methods