ITextView.GetTextElementSpan Method

Gets the SnapshotSpan of text that constitutes a text element (a single visual representation) at the given SnapshotPoint.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

SnapshotSpan GetTextElementSpan(
	SnapshotPoint point


Type: Microsoft.VisualStudio.Text.SnapshotPoint

The SnapshotPoint in the text snapshot at which to get the text element.

Return Value

Type: Microsoft.VisualStudio.Text.SnapshotSpan
A SnapshotSpan containing the bounds of the text element.


point is from the wrong ITextBuffer.

A text element may be a UTF-16 surrogate pair, consisting of a high surrogate character and a low surrogate character. If a point in the text buffer lies between a high surrogate character and a low surrogate character, the text element span will start at the high surrogate character and end at the low surrogate character.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft