共用方式為


IViewTaggerProvider Interface

Definition

Creates an ITagger<T> for a given buffer.

public interface class IViewTaggerProvider
public interface class IViewTaggerProvider
__interface IViewTaggerProvider
public interface IViewTaggerProvider
type IViewTaggerProvider = interface
Public Interface IViewTaggerProvider

Remarks

This is a MEF component part, and implementers must use the following attributes: [Export(typeof(ITaggerProvider))] Exports must specify at least one content type attribute and at least one tag type attribute. Exports may optionally specify a TextViewRole; if no TextViewRole is specified, the tagger applies to views with any roles.

[Export(typeof(ITaggerProvider))]
[ContentType(...)]                  // Required, must have at least one <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Utilities.ContentTypeAttribute"></xref> (and can have multiple ContentType attributes)
                                    //  Specifies the <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Utilities.IContentType"></xref>s which this provider provides taggers.
[TextViewRole(...))]                // Optional, can have multiple <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Editor.TextViewRoleAttribute"></xref>s.
                                    //  Specifies the required roles that a view must have before this tagger is created.
[TagType(...))]                     // Required, must have at least one <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Tagging.TagTypeAttribute"></xref> (and can have multiple TagType attributes)
                                    //  Specifies the types of taggers that can be created by this provider.
[Name(...)]                         // Required, can have only one <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Utilities.NameAttribute"></xref>
                                    //  Specifies the name of the tagger provider.
                                    //  Providers with a name attribute can be replaced by another tagger provider that specifies
                                    //  the name in their <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Editor.ReplacesAttribute"></xref>.
                                    //  In addition, providers with the same name as an <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Tagging.ITaggerProvider"></xref> will automatically
                                    //  suppress that provider if this provider's <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Tagging.IViewTaggerProvider.CreateTagger``1(Microsoft.VisualStudio.Text.Editor.ITextView,Microsoft.VisualStudio.Text.ITextBuffer)"></xref> returns a tagger.
[Replaces(...)]                     // Optional, can have zero or more <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Editor.ReplacesAttribute"></xref>
                                    //  Providers with a name attribute that matches replaces attribute of another provider will
                                    //  be suppressed. Note that the other tagger is suppressed even if the replacing provider does not
                                    //  supply a tagger.
[DeferCreation(OptionName = ...)]   // Optional, can have only one <xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Editor.DeferCreationAttribute"></xref>
                                    //  If specified, the tagger will not be created until the option (<xref data-throw-if-not-resolved="true" uid="Microsoft.VisualStudio.Text.Editor.IEditorOptions"></xref>) specified
                                    //  in the defer creation attribute becomes true.

Methods

CreateTagger<T>(ITextView, ITextBuffer)

Creates a tag provider for the specified view and buffer.

Applies to