Share via


IWpfTextView.GetTextViewLineContainingBufferPosition Method

Gets the IWpfTextViewLine that contains the specified text buffer position.

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

Syntax

'Declaration
Function GetTextViewLineContainingBufferPosition ( _
    bufferPosition As SnapshotPoint _
) As IWpfTextViewLine
IWpfTextViewLine GetTextViewLineContainingBufferPosition(
    SnapshotPoint bufferPosition
)
IWpfTextViewLine^ GetTextViewLineContainingBufferPosition(
    SnapshotPoint bufferPosition
)
abstract GetTextViewLineContainingBufferPosition : 
        bufferPosition:SnapshotPoint -> IWpfTextViewLine
function GetTextViewLineContainingBufferPosition(
    bufferPosition : SnapshotPoint
) : IWpfTextViewLine

Parameters

Return Value

Type: Microsoft.VisualStudio.Text.Formatting.IWpfTextViewLine
The IWpfTextViewLine that contains the specified buffer position.

Exceptions

Exception Condition
InvalidOperationException

The view has not completed initialization.

ArgumentOutOfRangeException

bufferPosition is not a valid buffer position.

Remarks

This method returns an IWpfTextViewLine if it exists in the view. If the line does not exist in the cache of formatted lines, it is formatted and added to the cache. The returned IWpfTextViewLine could be invalidated by either a layout by the view or by subsequent calls to this method.

.NET Framework Security

See Also

Reference

IWpfTextView Interface

Microsoft.VisualStudio.Text.Editor Namespace