Creating Your Own MEF-Based Editor Extension

We have now covered all of the ingredients necessary to build your own extension. Let’s walk through a simple example, end to end, and build an extension that displays some basic code metrics in a window in the corner of the editor. Functionally, we need to accomplish the following:

• Compute the required code stats by parsing the currently loaded code file

• Expose a set of properties on a WPF user control to hold those metrics; this user control also displays those metrics

• Display the WPF user control as an editor viewport adornment

Because this involves creating a new adornment pegged to the editor’s viewport, we have the luxury of starting with the code produced for us by the Viewport Adornment ...

Get Microsoft® Visual Studio® 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.