In This Article

ICollapsedRegionManager Interface

Provides the base requirements for a manager that can return information about collapsed regions.

public interface ICollapsedRegionManager

Methods

GetCollapsedRange(TextSnapshotOffset)

Returns a TextSnapshotRange indicating the collapsed region that contains the specified snapshot offset, if any.

TextSnapshotRange GetCollapsedRange(TextSnapshotOffset snapshotOffset)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset to examine.

Returns

TextSnapshotRange:

A TextSnapshotRange indicating the collapsed region that contains the specified snapshot offset, if any. If no collapsed range contains the offset, TextSnapshotRange.Deleted is returned.

GetCollapsedRanges(TextSnapshotRange)

Returns a collection of TextSnapshotRange objects that indicate the collapsed regions that intersect the specified snapshot range.

NormalizedTextSnapshotRangeCollection GetCollapsedRanges(TextSnapshotRange snapshotRange)
Parameter Type Description
snapshotRange TextSnapshotRange

The TextSnapshotRange in which to look for collapsed regions.

Returns

NormalizedTextSnapshotRangeCollection:

A NormalizedTextSnapshotRangeCollection that contains the intersecting ranges.

GetVisibleOffset(TextSnapshotOffset, Boolean)

Returns the visible offset that is closest to the specified offset.

int GetVisibleOffset(TextSnapshotOffset snapshotOffset, bool hasFarAffinity)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The desired offset.

hasFarAffinity System.Boolean

If the desired offset is within a collapsed region, the returned offset will be based on affinity. If true is passed, the collapsed region's end offset will be returned. Otherwise, the collapsed region's start offset will be returned.

Returns

System.Int32:

The visible offset that is closest to the specified offset.

Remarks

If the desired offset is visible, it is returned directly. Otherwise the desired offset is in a collapsed region, so the offset before/after the region (based on affinity) is returned.

Events

RegionsChanged

Occurs when one or more collapsed regions have changed.

event EventHandler<TextSnapshotRangeEventArgs> RegionsChanged

Event Type

System.EventHandler<TextSnapshotRangeEventArgs>