IAdornmentLayer.AddAdornment Method (AdornmentPositioningBehavior, Nullable<SnapshotSpan>, Object, UIElement, AdornmentRemovedCallback)
Adds a UIElement to the layer.
Namespace: Microsoft.VisualStudio.Text.Editor
Assembly: Microsoft.VisualStudio.Text.UI.Wpf (in Microsoft.VisualStudio.Text.UI.Wpf.dll)
Syntax
'宣言
Function AddAdornment ( _
behavior As AdornmentPositioningBehavior, _
visualSpan As Nullable(Of SnapshotSpan), _
tag As Object, _
adornment As UIElement, _
removedCallback As AdornmentRemovedCallback _
) As Boolean
bool AddAdornment(
AdornmentPositioningBehavior behavior,
Nullable<SnapshotSpan> visualSpan,
Object tag,
UIElement adornment,
AdornmentRemovedCallback removedCallback
)
bool AddAdornment(
AdornmentPositioningBehavior behavior,
Nullable<SnapshotSpan> visualSpan,
Object^ tag,
UIElement^ adornment,
AdornmentRemovedCallback^ removedCallback
)
abstract AddAdornment :
behavior:AdornmentPositioningBehavior *
visualSpan:Nullable<SnapshotSpan> *
tag:Object *
adornment:UIElement *
removedCallback:AdornmentRemovedCallback -> bool
function AddAdornment(
behavior : AdornmentPositioningBehavior,
visualSpan : Nullable<SnapshotSpan>,
tag : Object,
adornment : UIElement,
removedCallback : AdornmentRemovedCallback
) : boolean
Parameters
- behavior
Type: Microsoft.VisualStudio.Text.Editor.AdornmentPositioningBehavior
The positioning behavior of adornment.
- visualSpan
Type: System.Nullable<SnapshotSpan>
The span with which adornment is associated.
- tag
Type: System.Object
The tag associated with adornment.
- adornment
Type: System.Windows.UIElement
The UIElement to add to the view.
- removedCallback
Type: Microsoft.VisualStudio.Text.Editor.AdornmentRemovedCallback
The delegate to call when adornment is removed from the view.
Return Value
Type: System.Boolean
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).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.