Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IVsTextViewCreationListener Interface

A listener to the event raised when a text view adapter (IVsTextView) is created and initialized.

Namespace:  Microsoft.VisualStudio.Editor
Assembly:  Microsoft.VisualStudio.Editor (in Microsoft.VisualStudio.Editor.dll)

public interface IVsTextViewCreationListener

The IVsTextViewCreationListener type exposes the following members.

  NameDescription
Public methodVsTextViewCreatedCalled when a IVsTextView adapter has been created and initialized.
Top

Exporters must mark their export using the following attribute:

[Export(typeof(IVsTextViewCreationListener))] 

You filter this listener for a specific ContentTypeAttribute and TextViewRoleAttribute.

For example, to restrict this listener to views of editable text, you would use the following attributes:

[Export(typeof(IVsTextViewCreationListener))]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.Editable)]

For more information about using ContentTypeAttribute and TextViewRoleAttribute, see Editor Extension Points.

You can use this listener when you want to handle specific keystrokes in your extension. You do this by getting a reference to the text view adapter (IVsTextView) when the text view is created, then using this reference to add a command filter to a view (by using AddCommandFilter).

Show:
© 2015 Microsoft