In This Article

ITextView Interface

Provides the base requirements for a text view.

public interface ITextView

Properties

CollapsedRegionManager

Gets an ICollapsedRegionManager that provides information about collapsed regions in the view.

ICollapsedRegionManager CollapsedRegionManager { get; }

Property Value

ICollapsedRegionManager:

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

CurrentSnapshot

Gets the ITextSnapshot that currently is used to populate the view.

ITextSnapshot CurrentSnapshot { get; }

Property Value

ITextSnapshot:

The ITextSnapshot that currently is used to populate the view.

DefaultBackgroundColor

Gets the default background color.

Color DefaultBackgroundColor { get; }

Property Value

System.Windows.Media.Color:

The default background color.

DefaultCharacterWidth

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

double DefaultCharacterWidth { get; }

Property Value

System.Double:

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

DefaultFontFamilyName

Gets the default font family name.

string DefaultFontFamilyName { get; }

Property Value

System.String:

The default font family name.

DefaultFontSize

Gets the default font size.

float DefaultFontSize { get; }

Property Value

Single:

The default font size.

DefaultForegroundColor

Gets the default foreground color.

Color DefaultForegroundColor { get; }

Property Value

System.Windows.Media.Color:

The default foreground color.

DefaultLineHeight

Gets the default line height.

double DefaultLineHeight { get; }

Property Value

System.Double:

The default line height.

DefaultSpaceWidth

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

double DefaultSpaceWidth { get; }

Property Value

System.Double:

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

HighlightingStyleRegistry

Gets the IHighlightingStyleRegistry used by this view.

IHighlightingStyleRegistry HighlightingStyleRegistry { get; }

Property Value

IHighlightingStyleRegistry:

The IHighlightingStyleRegistry used by this view.

IsDefaultBackgroundColorLight

Gets whether the background color of the editor is light.

bool IsDefaultBackgroundColorLight { get; }

Property Value

System.Boolean:

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

IsWhitespaceVisible

Gets whether whitespace (spaces and tabs) is visible.

bool IsWhitespaceVisible { get; }

Property Value

System.Boolean:

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

Properties

Gets the dictionary containing custom properties for this object.

PropertyDictionary Properties { get; }

Property Value

PropertyDictionary:

The dictionary containing custom properties for this object.

ScrollState

Gets the view's current scroll state.

TextViewScrollState ScrollState { get; }

Property Value

TextViewScrollState:

The view's current scroll state.

SyntaxEditor

Gets the SyntaxEditor that contains the view.

SyntaxEditor SyntaxEditor { get; }

Property Value

SyntaxEditor:

The SyntaxEditor that contains the view.

TextAreaPadding

Gets the padding thickness around the text area content.

Thickness TextAreaPadding { get; }

Property Value

System.Windows.Thickness:

The padding thickness around the text area content.

TextAreaSize

Gets the size of the text area in text area coordinates.

Size TextAreaSize { get; }

Property Value

System.Windows.Size:

The size of the text area in text area coordinates.

TextAreaViewportBounds

Gets a System.Windows.Rect indicating the bounds of visible portion of the text area, relative to view coordinates.

Rect TextAreaViewportBounds { get; }

Property Value

System.Windows.Rect:

A System.Windows.Rect indicating the bounds of visible portion of the text area, relative to view coordinates.

UniqueId

Gets the System.Guid that uniquely identifies the view.

Guid UniqueId { get; }

Property Value

System.Guid:

The System.Guid that uniquely identifies the view.

VisibleViewLines

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

ITextViewLineCollection VisibleViewLines { get; }

Property Value

ITextViewLineCollection:

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

Remarks

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

VisualElement

Gets the System.Windows.FrameworkElement that represents the view.

FrameworkElement VisualElement { get; }

Property Value

System.Windows.FrameworkElement:

The System.Windows.FrameworkElement that represents the view.

ZoomLevel

Gets a percentage value indicating the zoom level.

double ZoomLevel { get; }

Property Value

System.Double:

A percentage value indicating the zoom level. 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>:

The ITagAggregator<T> that was created.

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:

An IAdornmentLayer for the view with the specified string-based key.

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:

An ITextViewLine that contains the specified TextPosition.

GetViewLine(ITextViewLine, Int32)

Returns the ITextViewLine that is relative to the specified ITextViewLine.

ITextViewLine GetViewLine(ITextViewLine viewLine, int lineDelta)
Parameter Type Description
viewLine ITextViewLine

The source ITextViewLine.

lineDelta System.Int32

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

Returns

ITextViewLine:

The ITextViewLine that is relative to the specified ITextViewLine.

GetViewLine(ITextViewLine, Int32, Boolean)

Returns the ITextViewLine that is relative to the specified ITextViewLine.

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

The source ITextViewLine.

lineDelta System.Int32

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

forceVirtualSpace System.Boolean

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

Returns

ITextViewLine:

The ITextViewLine that is relative to the specified ITextViewLine.

GetViewLine(Int32)

Returns an ITextViewLine that contains the specified offset.

ITextViewLine GetViewLine(int offset)
Parameter Type Description
offset System.Int32

The offset for which to retrieve an ITextViewLine.

Returns

ITextViewLine:

An ITextViewLine that contains the specified offset.

GetViewLine(Int32, Boolean)

Returns an ITextViewLine that contains the specified offset.

ITextViewLine GetViewLine(int offset, bool hasFarAffinity)
Parameter Type Description
offset System.Int32

The offset for which to retrieve an ITextViewLine.

hasFarAffinity System.Boolean

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.

Returns

ITextViewLine:

An ITextViewLine that contains the specified offset.

InvalidateRender()

Invalidates and repaints the view's canvas.

void InvalidateRender()

OffsetToPosition(Int32)

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

TextPosition OffsetToPosition(int offset)
Parameter Type Description
offset System.Int32

The offset of a character within the document.

Returns

TextPosition:

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

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

System.Int32:

The offset for the specified TextPosition within the view lines.

TransformFromTextArea(Point)

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

Point TransformFromTextArea(Point location)
Parameter Type Description
location System.Windows.Point

The System.Windows.Point to transform.

Returns

System.Windows.Point:

The transformed System.Windows.Point.

TransformFromTextArea(Rect)

Transforms the specified System.Windows.Rect in text area-relative coordinates to view-relative coordinates.

Rect TransformFromTextArea(Rect bounds)
Parameter Type Description
bounds System.Windows.Rect

The System.Windows.Rect to transform.

Returns

System.Windows.Rect:

The transformed System.Windows.Rect.

TransformToTextArea(Point)

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

Point TransformToTextArea(Point location)
Parameter Type Description
location System.Windows.Point

The System.Windows.Point to transform.

Returns

System.Windows.Point:

The transformed System.Windows.Point.

TransformToTextArea(Rect)

Transforms the specified System.Windows.Rect in view-relative coordinates to text area-relative coordinates.

Rect TransformToTextArea(Rect bounds)
Parameter Type Description
bounds System.Windows.Rect

The System.Windows.Rect to transform.

Returns

System.Windows.Rect:

The transformed System.Windows.Rect.

Events

Closed

Occurs when the view is closed.

event RoutedEventHandler Closed

Event Type

System.Windows.RoutedEventHandler

MarginsDestroyed

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

event RoutedEventHandler MarginsDestroyed

Event Type

System.Windows.RoutedEventHandler

TextAreaLayout

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

event EventHandler<TextViewTextAreaLayoutEventArgs> TextAreaLayout

Event Type

System.EventHandler<TextViewTextAreaLayoutEventArgs>