Fix for XAML Highlighting in VS2010

Both Visual Studio 2008 and 2010 have a rather annoying issue relating to how XAML is highlighted in the Text Editor. I’ve complained in the past that the XAML designer team introduced a separate set of classifications (i.e. options in the Fonts and Colors dialog) to configure how XAML code would be highlighted by the editor, when in fact, it is just, for the most part XML and it would’ve been used if the XAML editor just used the same color definitions used by the XML editor.

However, this isn’t 100% true. It turns out that the XAML code editor uses the colors and font settings configured for String (e.g. like a C# string) to render raw text inside an XML element in the XAML code. Normally, this isn’t too much of a problem, until you create a color scheme that uses a custom background color to highlight strings. Then, this is what you end up with in XAML:

Notice how the different background is used to render even spaces used for indentation, which looks very, very ugly.

Now, there’s nothing I can do about VS2008, but at least with VS2010, I was able to write an extension that fixes this problem. Here’s how it looks with the extension enabled: