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
- System.Collections.ObjectModel.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
- System.Double:
The opacity applies to the layer and all its contained visual elements.
View
Gets 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 | System.Windows.Rect | The initial bounds of the adornment. |
tag | System.Object | An System.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 |
removedCallback | System.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 | System.Windows.Rect | The initial bounds of the adornment. |
tag | System.Object | An System.Object that contains user-defined data about the adornment. |
removedCallback | System.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 | System.Windows.UIElement | The System.Windows.UIElement that is used to visually render the adornment. |
location | System.Windows.Point | The initial location of the adornment. |
tag | System.Object | An System.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 |
removedCallback | System.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 | System.Windows.UIElement | The System.Windows.UIElement that is used to visually render the adornment. |
location | System.Windows.Point | The initial location of the adornment. |
tag | System.Object | An System.Object that contains user-defined data about the adornment. |
removedCallback | System.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 System.Windows.UIElement.
IAdornment FindAdornment(UIElement visualElement)
Parameter | Type | Description |
---|---|---|
visualElement | System.Windows.UIElement | The System.Windows.UIElement for which to search. |
Returns
- IAdornment:
The IAdornment that contains the specified System.Windows.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 | System.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 | System.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
- System.Boolean:
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 | System.Collections.Generic.IEnumerable<IAdornment> | The collection of adornments to remove. |
Returns
- System.Boolean:
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
- System.Boolean:
true
if any adornments were removed; otherwise,false
.