[]
        
(Showing Draft Content)

C1.WPF.RichTextBox.Documents.C1TextPointer.GetPositionAtOffset

GetPositionAtOffset Method

GetPositionAtOffset(int, Predicate<Tag>)

Returns the position at an offset of the current position, optionally not counting some positions.

Declaration
public C1TextPointer GetPositionAtOffset(int offset, Predicate<Tag> tagFilter)
Parameters
Type Name Description
int offset

The offset.

Predicate<Tag> tagFilter

A predicate that can be called to check if a Tag should count as offset. The predicate should return true iff the tag doesn't count. Can be null, which means no filter.

Returns
Type Description
C1TextPointer

A new position at the offset indicated, or null if the offset goes off the document.

Remarks

This method can be used to linearly traverse a C1Document tree.

Start and end tags in each C1TextElement count as items for the traverse, for instance if the position is in an element with children, a position at offset 1 will be the ContentStart of the C1TextElement where this C1TextPointer is positioned.

If this C1TextPointer is positioned in a C1Run then it traverses the text of the C1Run.

GetPositionAtOffset(int)

Equivalent to GetPositionAtOffset(int, Predicate<Tag>) with null as tagFilter.

Declaration
public C1TextPointer GetPositionAtOffset(int offset)
Parameters
Type Name Description
int offset

The offset.

Returns
Type Description
C1TextPointer

A new position at the offset indicated, or null if the offset goes off the document.