In This Article

IEditorView Interface

Provides the base requirements for a text view that supports editing and is presented in a SyntaxEditor.

public interface IEditorView : ITextView

Properties

ContainsFocus

Gets whether the view currently has or contains keyboard focus.

bool ContainsFocus { get; }

Property Value

Boolean:

true if the view currently has or contains keyboard focus; otherwise, false.

Remarks

A view can contain focus if a nested control such as an adornment or search overlay pane has focus.

CurrentSnapshotLine

Gets the current ITextSnapshotLine that the primary caret appears on within the view.

ITextSnapshotLine CurrentSnapshotLine { get; }

Property Value

ITextSnapshotLine:

The current ITextSnapshotLine that the primary caret appears on within the view.

CurrentViewLine

Gets the current ITextViewLine that the primary caret appears on within the view.

ITextViewLine CurrentViewLine { get; }

Property Value

ITextViewLine:

The current ITextViewLine that the primary caret appears on within the view.

HasFocus

Gets whether the view currently has keyboard focus.

bool HasFocus { get; }

Property Value

Boolean:

true if the view currently has keyboard focus; otherwise, false.

HighlightedResultSearchOptions

Gets or sets the ISearchOptions to use for searching when highlighting search results.

ISearchOptions HighlightedResultSearchOptions { get; set; }

Property Value

ISearchOptions:

The ISearchOptions to use for searching when highlighting search results.

Remarks

Highlighted results are displayed when using incremental search and the IsSearchResultHighlightingEnabled property is set to true. This property can also be manually set when using a search pane as the user types, so that results will be immediately displayed. Set the property to null to stop highlighting.

IntelliPrompt

Gets the IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.

IEditorViewIntelliPrompt IntelliPrompt { get; }

Property Value

IEditorViewIntelliPrompt:

The IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.

IsActive

Gets whether the view is the currently-active view in the editor.

bool IsActive { get; }

Property Value

Boolean:

true if the view is the currently-active view in the editor; otherwise, false.

Remarks

The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active. Use the HasFocus property to determine if the view currently has keyboard focus.

IsIncrementalSearchActive

Gets or sets whether incremental searching is active.

bool IsIncrementalSearchActive { get; set; }

Property Value

Boolean:

true if incremental searching is active; otherwise, false.

Margins

Gets the collection of margins that are currently in the view.

IEditorViewMarginCollection Margins { get; }

Property Value

IEditorViewMarginCollection:

The collection of margins that are currently in the view.

OverlayPanes

Gets the collection of IOverlayPane instances that are open in the view.

IEditorViewOverlayPaneCollection OverlayPanes { get; }

Property Value

IEditorViewOverlayPaneCollection:

The collection of IOverlayPane instances that are open in the view.

Placement

Gets a EditorViewPlacement indicating the location of the view.

EditorViewPlacement Placement { get; }

Property Value

EditorViewPlacement:

A EditorViewPlacement indicating the location of the view.

PositionFinder

Gets the ITextPositionFinder that can be used to find TextPosition objects relative to another specified TextPosition.

ITextPositionFinder PositionFinder { get; }

Property Value

ITextPositionFinder:

The ITextPositionFinder instance.

Scroller

Gets the IEditorViewScroller to use for scrolling the view.

IEditorViewScroller Scroller { get; }

Property Value

IEditorViewScroller:

The IEditorViewScroller to use for scrolling the view.

Searcher

Gets the IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.

IEditorViewSearcher Searcher { get; }

Property Value

IEditorViewSearcher:

The IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.

SelectedText

Gets or sets the text of the current primary selection range in the view.

string SelectedText { get; set; }

Property Value

String:

The text of the current primary selection range in the view.

Selection

Gets an IEditorViewSelection that manages the selection within the view.

IEditorViewSelection Selection { get; }

Property Value

IEditorViewSelection:

An IEditorViewSelection that manages the selection within the view.

TextChangeActions

Gets the IEditorViewTextChangeActions that is used to perform text change actions in the view.

IEditorViewTextChangeActions TextChangeActions { get; }

Property Value

IEditorViewTextChangeActions:

The IEditorViewTextChangeActions that is used to perform text change actions in the view.

Methods

Activate()

Activates this view.

void Activate()

Remarks

The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active.

CopyAndAppendToClipboard()

Copies the currently selected text and appends it to the existing text on the clipboard.

void CopyAndAppendToClipboard()

CopyToClipboard()

Copies the currently selected text to the clipboard.

void CopyToClipboard()

CutAndAppendToClipboard()

Cuts the currently selected text and appends it to the existing text on the clipboard.

void CutAndAppendToClipboard()

CutLineToClipboard()

Cuts the currently active view line to the clipboard.

void CutLineToClipboard()

CutToClipboard()

Cuts the currently selected text to the clipboard.

void CutToClipboard()

DeleteSelectedText(ITextChangeType)

Performs a delete text change by deleting the view's selected text ranges.

bool DeleteSelectedText(ITextChangeType type)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

DeleteSelectedText(ITextChangeType, IEditorViewTextChangeOptions)

Performs a delete text change by deleting the view's selected text ranges.

bool DeleteSelectedText(ITextChangeType type, IEditorViewTextChangeOptions options)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

options IEditorViewTextChangeOptions

The IEditorViewTextChangeOptions for the change.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

ExecuteEditAction(IEditAction)

Executes the specified IEditAction within the view and records the action within a macro when appropriate.

bool ExecuteEditAction(IEditAction action)
Parameter Type Description
action IEditAction

The IEditAction to execute.

Returns

Boolean:

true if the action was able to execute; otherwise, false.

ExportSelectedText(ITextExporter)

Exports the selected text to another text format, such as HTML or RTF.

string ExportSelectedText(ITextExporter exporter)
Parameter Type Description
exporter ITextExporter

The ITextExporter to use for the export operation.

Returns

String:

The exported text.

FindCurrentWordEnd()

Returns the document offset of the word end character that occurs at or after the primary caret.

int FindCurrentWordEnd()

Returns

Int32:

The document offset of the word end character that occurs at or after the primary caret.

FindCurrentWordStart()

Returns the document offset of the word start character that occurs at or before the primary caret.

int FindCurrentWordStart()

Returns

Int32:

The document offset of the word start character that occurs at or before the primary caret.

FindNextWordStart()

Returns the document offset of the word start character that occurs after the primary caret.

int FindNextWordStart()

Returns

Int32:

The document offset of the word start character that occurs after the primary caret.

FindPreviousWordStart()

Returns the document offset of the word start character that occurs before the primary caret.

int FindPreviousWordStart()

Returns

Int32:

The document offset of the word start character that occurs before the primary caret.

Focus()

Ensures the view has focus.

bool Focus()

Returns

Boolean:

true if focus was successfully set; otherwise, false.

Focus(FocusState)

Ensures the view has focus.

bool Focus(FocusState state)
Parameter Type Description
state FocusState

A FocusState specifying the reason for focus to be set.

Returns

Boolean:

true if focus was successfully set; otherwise, false.

GetCharacterBounds(TextPosition)

Returns the TextBounds for the specified TextPosition, relative to the text area's coordinates.

TextBounds GetCharacterBounds(TextPosition position)
Parameter Type Description
position TextPosition

The TextPosition whose bounds need to be retrieved.

Returns

TextBounds:

A TextBounds containing the visible character bounds for the specified TextPosition.

GetCharacterBounds(Int32)

Returns the TextBounds for the specified offset, relative to the text area's coordinates.

TextBounds GetCharacterBounds(int offset)
Parameter Type Description
offset Int32

The offset whose bounds need to be retrieved.

Returns

TextBounds:

A TextBounds containing the visible character bounds for the specified offset.

GetCharacterBounds(Int32, Boolean)

Returns the TextBounds for the specified offset, relative to the text area's coordinates.

TextBounds GetCharacterBounds(int offset, bool hasFarAffinity)
Parameter Type Description
offset Int32

The offset whose bounds need to be retrieved.

hasFarAffinity 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

TextBounds:

A TextBounds containing the visible character bounds for the specified offset.

GetCharacterColumn(TextPosition)

Returns the column index within the view for the specified TextPosition.

int GetCharacterColumn(TextPosition position)
Parameter Type Description
position TextPosition

The TextPosition whose column index is being requested.

Returns

Int32:

The column index within the view for the specified TextPosition.

GetCharacterColumn(Int32)

Returns the column index within the view for the specified offset.

int GetCharacterColumn(int offset)
Parameter Type Description
offset Int32

The offset whose column index is being requested.

Returns

Int32:

The column index within the view for the specified offset.

GetCharacterColumn(Int32, Boolean)

Returns the column index within the view for the specified offset.

int GetCharacterColumn(int offset, bool hasFarAffinity)
Parameter Type Description
offset Int32

The offset whose column index is being requested.

hasFarAffinity 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

Int32:

The column index within the view for the specified offset.

GetCharacterIndexRanges(TextPositionRange)

Returns the collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.

IList<Range> GetCharacterIndexRanges(TextPositionRange positionRange)
Parameter Type Description
positionRange TextPositionRange

The TextPositionRange to examine.

Returns

IList<Range>:

The collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.

GetCharacterIndexRanges(TextPositionRange, Int32)

Returns the collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.

IList<Range> GetCharacterIndexRanges(TextPositionRange positionRange, int minimumLines)
Parameter Type Description
positionRange TextPositionRange

The TextPositionRange to examine.

minimumLines Int32

The minimum number of lines to return, used for block selections.
For continuous stream selections, pass 1.

Returns

IList<Range>:

The collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.

GetCurrentWordText()

Gets the text of the current word.

string GetCurrentWordText()

Returns

String:

The text of the current word.

GetCurrentWordTextRange()

Gets the TextRange for the current word.

TextRange GetCurrentWordTextRange()

Returns

TextRange:

A TextRange containing the offset range for the current word.

GetReader()

Returns an ITextSnapshotReader, initialized at the caret offset, that can be used to navigate through the text and token contents of the current snapshot.

ITextSnapshotReader GetReader()

Returns

ITextSnapshotReader:

An ITextBufferReader, initialized at the caret offset, that can be used to navigate through the text and token contents of the current snapshot.

GetTextStatisticsForSelectedText()

Returns the ITextStatistics for the selected text in the view, which provides numerous statistics about the text such as word, sentence, character counts as well as readability scores.

ITextStatistics GetTextStatisticsForSelectedText()

Returns

ITextStatistics:

The ITextStatistics for the selected text in the view.

GetViewLine(Double, LocationToPositionAlgorithm)

Gets the ITextViewLine that contains the specified Y location.

ITextViewLine GetViewLine(double verticalLocation, LocationToPositionAlgorithm algorithm)
Parameter Type Description
verticalLocation Double

The Y location to examine, in text area-relative coordinates.

algorithm LocationToPositionAlgorithm

The LocationToPositionAlgorithm to use for calculation.

Returns

ITextViewLine:

The ITextViewLine that contains the specified Y location.

GetVirtualCharacterFillString(TextPosition, Boolean)

Gets a string specifying the indentation (tabs and/or spaces) needed to fill a view line up to the specified TextPosition.

string GetVirtualCharacterFillString(TextPosition position, bool returnCharacterFill)
Parameter Type Description
position TextPosition

The TextPosition to be examined.

returnCharacterFill Boolean

Whether to return a character fill in addition to line fill.

Returns

String:

A string specifying the indentation (tabs and/or spaces) needed to fill a view line up to the specified TextPosition.

Remarks

This method will return langword_csharp_String.Empty if the character is not a virtual character.

InsertFile(String)

Inserts the text contents of the specified file into the view, replacing any selected text.

void InsertFile(string path)
Parameter Type Description
path String

The fully qualified path to the file that will be inserted.

InsertSurroundingText(ITextChangeType, String, String)

Inserts text into the document that surrounds the currently selected text ranges in the view.

bool InsertSurroundingText(ITextChangeType type, string preText, string postText)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

preText String

The text to insert before the currently selected text ranges.

postText String

The text to insert after the currently selected text ranges.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

InsertSurroundingText(ITextChangeType, String, String, Boolean)

Inserts text into the document that surrounds the currently selected text ranges in the view.

bool InsertSurroundingText(ITextChangeType type, string preText, string postText, bool reselect)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

preText String

The text to insert before the currently selected text ranges.

postText String

The text to insert after the currently selected text ranges.

reselect Boolean

Whether to reselect the inner text.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

InsertSurroundingText(String, String)

Inserts text into the document that surrounds the currently selected text ranges in the view, using a TextChangeTypes.TextReplacement change type.

bool InsertSurroundingText(string preText, string postText)
Parameter Type Description
preText String

The text to insert before the currently selected text ranges.

postText String

The text to insert after the currently selected text ranges.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

IsVirtualCharacter(TextPosition, Boolean)

Returns whether the specified TextPosition is a virtual character (beyond line or document end).

bool IsVirtualCharacter(TextPosition position, bool lineTerminatorsAreVirtual)
Parameter Type Description
position TextPosition

The TextPosition to examine.

lineTerminatorsAreVirtual Boolean

Indicates whether to treat line terminators as virtual characters.

Returns

Boolean:

true if the specified TextPosition is a virtual character (beyond line or document end); otherwise, false.

IsVirtualLine(TextPosition)

Returns whether the specified TextPosition is a virtual line (beyond document end).

bool IsVirtualLine(TextPosition position)
Parameter Type Description
position TextPosition

The TextPosition to examine.

Returns

Boolean:

true if the specified TextPosition is a virtual line (beyond document end); otherwise, false.

IsVirtualLine(Int32)

Returns whether the specified TextPosition line index is a virtual line (beyond document end).

bool IsVirtualLine(int positionLineIndex)
Parameter Type Description
positionLineIndex Int32

The TextPosition line index to examine.

Returns

Boolean:

true if the specified TextPosition line index is a virtual line (beyond document end); otherwise, false.

LocationToPosition(Point, LocationToPositionAlgorithm)

Returns the TextPosition for the specified location.

TextPosition LocationToPosition(Point location, LocationToPositionAlgorithm algorithm)
Parameter Type Description
location Point

A Point specifying a location in text area-relative coordinates.

algorithm LocationToPositionAlgorithm

The LocationToPositionAlgorithm to use for calculation.

Returns

TextPosition:

The TextPosition for the specified location.

Remarks

If using an absolute algorithm and no valid TextPosition is located, TextPosition.Empty will be returned.

PasteFromClipboard()

Pastes text from the clipboard into the selection.

void PasteFromClipboard()

PasteFromClipboard(IDataObject)

Pastes text from the specified clipboard IDataObject into the selection.

void PasteFromClipboard(IDataObject clipboardData)
Parameter Type Description
clipboardData IDataObject

An IDataObject containing clipboard data.

ReplaceSelectedText(ITextChangeType, String)

Performs a replace text change by overwriting the view's selected text ranges.

bool ReplaceSelectedText(ITextChangeType type, string text)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

text String

The text to insert.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

ReplaceSelectedText(ITextChangeType, String, IEditorViewTextChangeOptions)

Performs a replace text change by overwriting the view's selected text ranges.

bool ReplaceSelectedText(ITextChangeType type, string text, IEditorViewTextChangeOptions options)
Parameter Type Description
type ITextChangeType

An ITextChangeType specifying the type of change.

text String

The text to insert.

options IEditorViewTextChangeOptions

The IEditorViewTextChangeOptions for the change.

Returns

Boolean:

true if a text change was allowed to occur; otherwise, false.

StartPointerSelection(InputPointerButtonEventArgs)

Starts a pointer selection operation during a pointer button down event.

void StartPointerSelection(InputPointerButtonEventArgs e)
Parameter Type Description
e InputPointerButtonEventArgs

A InputPointerButtonEventArgs that contains the event data.

Remarks

The left or right pointer button must be pressed when this method is called. When the left button pointer selection starts, the pointer will be captured and further selection processing will be handled automatically.

Events

HasFocusChanged

Occurs when the HasFocus property value is changed.

event RoutedEventHandler HasFocusChanged

Event Type

RoutedEventHandler

HighlightedResultSearchOptionsChanged

Occurs when the HighlightedResultSearchOptions property value is changed.

event RoutedEventHandler HighlightedResultSearchOptionsChanged

Event Type

RoutedEventHandler

SelectionChanged

Occurs after the selection is changed.

event EventHandler<EditorViewSelectionEventArgs> SelectionChanged

Event Type

EventHandler<EditorViewSelectionEventArgs>

Inherited Members