Partilhar via


IAdornmentLayer.AddAdornment Method

Definition

Overloads

AddAdornment(SnapshotSpan, Object, UIElement)

Adds a AdornmentPositioningBehavior.TextRelative UIElement to the layer.

AddAdornment(AdornmentPositioningBehavior, Nullable<SnapshotSpan>, Object, UIElement, AdornmentRemovedCallback)

Adds a UIElement to the layer.

AddAdornment(SnapshotSpan, Object, UIElement)

Adds a AdornmentPositioningBehavior.TextRelative UIElement to the layer.

public:
 bool AddAdornment(Microsoft::VisualStudio::Text::SnapshotSpan visualSpan, System::Object ^ tag, System::Windows::UIElement ^ adornment);
public bool AddAdornment (Microsoft.VisualStudio.Text.SnapshotSpan visualSpan, object tag, System.Windows.UIElement adornment);
abstract member AddAdornment : Microsoft.VisualStudio.Text.SnapshotSpan * obj * System.Windows.UIElement -> bool
Public Function AddAdornment (visualSpan As SnapshotSpan, tag As Object, adornment As UIElement) As Boolean

Parameters

visualSpan
SnapshotSpan

The span with which adornment is associated.

tag
Object

The tag associated with adornment.

adornment
UIElement

The UIElement to add to the view.

Returns

true if adornment was added to the layer, otherwise false. visualSpan does not intersect the text that is visible in the view.

Remarks

This is equivalent to calling AddElement(AdornmentPositioningBehavior.TextRelative, visualSpan, tag, adornment, null);

Applies to

AddAdornment(AdornmentPositioningBehavior, Nullable<SnapshotSpan>, Object, UIElement, AdornmentRemovedCallback)

Adds a UIElement to the layer.

public:
 bool AddAdornment(Microsoft::VisualStudio::Text::Editor::AdornmentPositioningBehavior behavior, Nullable<Microsoft::VisualStudio::Text::SnapshotSpan> visualSpan, System::Object ^ tag, System::Windows::UIElement ^ adornment, Microsoft::VisualStudio::Text::Editor::AdornmentRemovedCallback ^ removedCallback);
public bool AddAdornment (Microsoft.VisualStudio.Text.Editor.AdornmentPositioningBehavior behavior, Microsoft.VisualStudio.Text.SnapshotSpan? visualSpan, object tag, System.Windows.UIElement adornment, Microsoft.VisualStudio.Text.Editor.AdornmentRemovedCallback removedCallback);
abstract member AddAdornment : Microsoft.VisualStudio.Text.Editor.AdornmentPositioningBehavior * Nullable<Microsoft.VisualStudio.Text.SnapshotSpan> * obj * System.Windows.UIElement * Microsoft.VisualStudio.Text.Editor.AdornmentRemovedCallback -> bool
Public Function AddAdornment (behavior As AdornmentPositioningBehavior, visualSpan As Nullable(Of SnapshotSpan), tag As Object, adornment As UIElement, removedCallback As AdornmentRemovedCallback) As Boolean

Parameters

behavior
AdornmentPositioningBehavior

The positioning behavior of adornment.

visualSpan
Nullable<SnapshotSpan>

The span with which adornment is associated.

tag
Object

The tag associated with adornment.

adornment
UIElement

The UIElement to add to the view.

removedCallback
AdornmentRemovedCallback

The delegate to call when adornment is removed from the view.

Returns

true if adornment was added to the layer, otherwise false. visualSpan does not intersect the text that is visible in the view.

Remarks

If visualSpan is specified, then the adornment will be removed whenever any line that crosses visualSpan is formatted.

If visualSpan has a length of zero, then it will be invalidated when the line that contains the following character is invalidated (or the last line, if the visual span is at the end of the buffer).

Applies to