Delen via


IWpfTextViewMarginProvider Interface

Creates an IWpfTextViewMargin for a given IWpfTextViewHost.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI.Wpf (in Microsoft.VisualStudio.Text.UI.Wpf.dll)

Syntax

'Declaration
Public Interface IWpfTextViewMarginProvider
public interface IWpfTextViewMarginProvider
public interface class IWpfTextViewMarginProvider
type IWpfTextViewMarginProvider =  interface end
public interface IWpfTextViewMarginProvider

The IWpfTextViewMarginProvider type exposes the following members.

Methods

  Name Description
Public method CreateMargin Creates an IWpfTextViewMargin for the given IWpfTextViewHost.

Top

Remarks

This is a MEF component part, and should be exported with the following attribute:

[Export(typeof(IWpfTextViewMarginProvider))] 

Exporters must supply a MarginContainerAttribute (with one of the PredefinedMarginNames as the container), ContentTypeAttribute, OrderAttribute (with respect to one of the PredefinedMarginNames), TextViewRoleAttribute, and NameAttribute.

For more information about margins, see the "Margins" section of Inside the Editor. For information about extending margins and scrollbars, see the "Extending Margins and Scrollbars" section in Editor Extension Points.

Examples

The following example shows how to set up the attributes for this export:

Name("TestMarginProvider")]
[Export(typeof(IWpfTextViewMarginProvider))]
[Order(Before = PredefinedMarginNames.VerticalScrollBarContainer)]
[MarginContainer(PredefinedMarginNames.RightControl)]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]

See Also

Reference

Microsoft.VisualStudio.Text.Editor Namespace