In This Article

IAdornmentLayer Interface

Provides the base requirements for an adornment layer within an ITextView that contains IAdornment objects.

public interface IAdornmentLayer : IKeyedObject

Remarks

Use the AddAdornment method to create a new IAdornment within the layer.

Properties

Adornments

Gets a read-only collection of the IAdornment objects in the layer.

ReadOnlyCollection<IAdornment> Adornments { get; }

Property Value

ReadOnlyCollection<IAdornment>:

A read-only collection of the IAdornment objects in the layer.

Opacity

Gets or sets the opacity applies to the layer and all its contained visual elements.

double Opacity { get; set; }

Property Value

double:

The opacity applies to the layer and all its contained visual elements.

View

Gets the ITextView to which this layer is attached.

ITextView View { get; }

Property Value

ITextView:

The ITextView to which this layer is attached.

Methods

AddAdornment(AdornmentChangeReason, DrawAdornmentCallback, Rect, object, ITextViewLine, TextSnapshotRange, TextRangeTrackingModes, Action<IAdornment>)

Adds a new adornment to the layer that is tracked with a particular text range

IAdornment AddAdornment(AdornmentChangeReason reason, DrawAdornmentCallback drawCallback, Rect bounds, object tag, ITextViewLine viewLine, TextSnapshotRange snapshotRange, TextRangeTrackingModes trackingModes, Action<IAdornment> removedCallback)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the add reason.

drawCallback DrawAdornmentCallback

The callback method that is invoked to draw the adornment.

bounds Rect

The initial bounds of the adornment.

tag object

An object that contains user-defined data about the adornment.

viewLine ITextViewLine

The ITextViewLine with which the adornment is associated, if any.

snapshotRange TextSnapshotRange

The TextSnapshotRange that indicates the range of the adornment.

trackingModes TextRangeTrackingModes

A TextRangeTrackingModes indicating the tracking modes to use. A common value is ExpandBothEdges.

removedCallback Action<IAdornment>

The callback method that is invoked when the adornment is removed from its parent IAdornmentLayer.

Returns

IAdornment:

The IAdornment that was created.

AddAdornment(AdornmentChangeReason, DrawAdornmentCallback, Rect, object, Action<IAdornment>)

Adds a new adornment to the layer that is not tracked with a particular text range.

IAdornment AddAdornment(AdornmentChangeReason reason, DrawAdornmentCallback drawCallback, Rect bounds, object tag, Action<IAdornment> removedCallback)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the add reason.

drawCallback DrawAdornmentCallback

The callback method that is invoked to draw the adornment.

bounds Rect

The initial bounds of the adornment.

tag object

An object that contains user-defined data about the adornment.

removedCallback Action<IAdornment>

The callback method that is invoked when the adornment is removed from its parent IAdornmentLayer.

Returns

IAdornment:

The IAdornment that was created.

AddAdornment(AdornmentChangeReason, UIElement, Point, object, ITextViewLine, TextSnapshotRange, TextRangeTrackingModes, Action<IAdornment>)

Adds a new adornment to the layer that is tracked with a particular text range

IAdornment AddAdornment(AdornmentChangeReason reason, UIElement visualElement, Point location, object tag, ITextViewLine viewLine, TextSnapshotRange snapshotRange, TextRangeTrackingModes trackingModes, Action<IAdornment> removedCallback)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the add reason.

visualElement UIElement

The UIElement that is used to visually render the adornment.

location Point

The initial location of the adornment.

tag object

An object that contains user-defined data about the adornment.

viewLine ITextViewLine

The ITextViewLine with which the adornment is associated, if any.

snapshotRange TextSnapshotRange

The TextSnapshotRange that indicates the range of the adornment.

trackingModes TextRangeTrackingModes

A TextRangeTrackingModes indicating the tracking modes to use. A common value is ExpandBothEdges.

removedCallback Action<IAdornment>

The callback method that is invoked when the adornment is removed from its parent IAdornmentLayer.

Returns

IAdornment:

The IAdornment that was created.

AddAdornment(AdornmentChangeReason, UIElement, Point, object, Action<IAdornment>)

Adds a new adornment to the layer that is not tracked with a particular text range.

IAdornment AddAdornment(AdornmentChangeReason reason, UIElement visualElement, Point location, object tag, Action<IAdornment> removedCallback)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the add reason.

visualElement UIElement

The UIElement that is used to visually render the adornment.

location Point

The initial location of the adornment.

tag object

An object that contains user-defined data about the adornment.

removedCallback Action<IAdornment>

The callback method that is invoked when the adornment is removed from its parent IAdornmentLayer.

Returns

IAdornment:

The IAdornment that was created.

FindAdornment(UIElement)

Returns the IAdornment that contains the specified UIElement.

IAdornment FindAdornment(UIElement visualElement)
Parameter Type Description
visualElement UIElement

The UIElement for which to search.

Returns

IAdornment:

The IAdornment that contains the specified UIElement.

FindAdornments(TextSnapshotRange)

Returns an array of IAdornment objects that intersect the specified TextSnapshotRange.

IAdornment[] FindAdornments(TextSnapshotRange snapshotRange)
Parameter Type Description
snapshotRange TextSnapshotRange

The TextSnapshotRange to examine.

Returns

IAdornment[]:

An array of IAdornment objects that intersect the specified TextSnapshotRange.

FindAdornments(ITextViewLine)

Returns an array of IAdornment objects that are associated with the specified ITextViewLine.

IAdornment[] FindAdornments(ITextViewLine viewLine)
Parameter Type Description
viewLine ITextViewLine

The ITextViewLine for which to search.

Returns

IAdornment[]:

An array of IAdornment objects that are associated with the specified ITextViewLine.

FindAdornments(object)

Returns an array of IAdornment objects that contain the specified tag.

IAdornment[] FindAdornments(object tag)
Parameter Type Description
tag object

The tag object for which to search.

Returns

IAdornment[]:

An array of IAdornment objects that contain the specified tag.

FindAdornments(Predicate<IAdornment>)

Returns an array of IAdornment objects that pass the specified match predicate.

IAdornment[] FindAdornments(Predicate<IAdornment> match)
Parameter Type Description
match Predicate<IAdornment>

The predicate to use for determining adornments that meet custom criteria.

Returns

IAdornment[]:

An array of IAdornment objects that pass the specified match predicate.

RemoveAdornment(AdornmentChangeReason, IAdornment)

Removes the specified adornment from the layer.

bool RemoveAdornment(AdornmentChangeReason reason, IAdornment adornmentToRemove)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the remove reason.

adornmentToRemove IAdornment

The adornment to remove.

Returns

bool:

true if the adornment were removed; otherwise, false.

RemoveAdornments(AdornmentChangeReason, IEnumerable<IAdornment>)

Removes the specified adornments from the layer.

bool RemoveAdornments(AdornmentChangeReason reason, IEnumerable<IAdornment> adornmentsToRemove)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the remove reason.

adornmentsToRemove IEnumerable<IAdornment>

The collection of adornments to remove.

Returns

bool:

true if any adornments were removed; otherwise, false.

RemoveAllAdornments(AdornmentChangeReason)

Removes all adornments in the layer.

bool RemoveAllAdornments(AdornmentChangeReason reason)
Parameter Type Description
reason AdornmentChangeReason

An AdornmentChangeReason indicating the remove reason.

Returns

bool:

true if any adornments were removed; otherwise, false.

Inherited Members