Fabrice's weblog

Tools and Source

News

My .NET Toolbox
An error occured. See the script errors signaled by your web browser.
No tools selected yet
.NET tools by SharpToolbox.com

Read sample chapters or buy LINQ in Action now!
Our LINQ book is also available on AMAZON

.NET jobs

Emplois .NET

transatlantys hot news

Contact

Me

Others

Selected content

Life changing XAML tip for Visual Studio

If you've worked with XAML in Visual Studio 2008 (SP1), either for WPF or Silverlight work, you know how painful it is.

Of course, the first thing to do is to get rid of the design view. It's slow as a snail and it's pretty useless anyway.
Make yourself a favor, and check "Always open documents in full XAML view" in "Tools | Options | Text Editor | XAML | Miscellaneous".

Even if this a great improvement, you'll soon realize that Visual Studio still sucks up a lot of your time and energy when you switch to a XAML file in the text editor. The same happens when you switch back to Visual Studio from another application. Now, try to open two XAML files side-by-side and the time to display them doubles. Same thing when you switch between two XAML files.

What the heck, there's gotta be a solution to this damnation! How could we develop good WPF or Silverlight applications if this XAML editor keeps getting on our nerves?
I've been enduring this for a long time. I had tried to edit the XAML file as an XML file, but this disabled IntelliSense, for some reason. So the XML editor was not an option.

Microsoft doesn't seem to be in a hurry to provide a fix... Luckily, today I found an unexpected solution: use the "Source Code (Text) Editor". It doesn't seem obvious based on its name, but this editor provides XAML IntelliSense, XML collapsing, and the XAML context menu.
To use this, it's quite simple:

  1. Right-click on a XAML file in the Solution Explorer
  2. Select "Open With..."
  3. Select "Source Code (Text) Editor"
  4. Click on "Set as Default"
  5. Click OK
  6. You're done!

The cherry on the cake: If you want to use the default XAML editor (with its split view, navigator, etc.), you just have to select "View Designer" in the text editor's context menu or use SHIFT+F7.

Enjoy your newly gained life!

Update: If you experience crashes when editing XAML files, this hot fix may help.

Comments

Community Blogs said:

In this issue: Fabrice Marguerie, Tim Heuer, and Andrej Tozon. Shoutouts: Shawn Wildermuth is taking

# January 28, 2009 11:54 PM

Kunal Shetye said:

Thanks for this Awesome tip!

Saved me a lot of time :)

# January 29, 2009 12:32 AM

XAML Tip #1 « Developer 4 Life’s Weblog said:

Pingback from  XAML Tip #1 « Developer 4 Life’s Weblog

# January 29, 2009 12:37 AM

Silverlight Travel » Life changer XAML tip for Visual Studio said:

Pingback from  Silverlight Travel » Life changer XAML tip for Visual Studio

# January 29, 2009 1:12 AM

Silverlight Travel said:

Hi Fabrice,

works great. Thanks for saving my time and nerve.

Peter Loebel

# January 29, 2009 1:17 AM

Romain Verdier said:

That's true, we don't need the readonly preview that much when editing XAML from VS. The tip was probably too obvious for me to think about it...

Thanks !

# January 29, 2009 1:40 AM

Andy said:

Good tip :-)

However, what I think what we were really meant to do was go out and spend hundreds and hundreds of bucks on Expression Blend. Yeh right.

# January 29, 2009 3:33 AM

dan_vestergaard said:

Excellent tip.

I have been using VS for editing XAML for a couple of years now. I seldom really need the design view, so this has given me a nice relaxation effect. One tends to get a bit irritable in those late hours before a deadline waiting for the designer to load :)

# January 29, 2009 4:08 AM

Christopher Steen said:

Link Listing - January 28, 2009

# January 29, 2009 7:22 AM

Christopher Steen said:

WPF Creating a WPF Application With Prism v2 – Shell [Via: hoarked ] Life changer XAML tip for Visual...

# January 29, 2009 7:23 AM

Dew Drop – January 29, 2009 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop – January 29, 2009 | Alvin Ashcraft's Morning Dew

# January 29, 2009 11:32 AM

Kris said:

Whow, didn't know i was ever gonna open e few xaml files just for fun...  They just open now !!! Thanks !!!

# January 29, 2009 12:34 PM

Newly Noted #12 | Patrick Verbruggen's Blog said:

Pingback from  Newly Noted #12 | Patrick Verbruggen's Blog

# January 29, 2009 5:40 PM

fwh said:

Great! And it works with RockScroll too. Thanks

# January 29, 2009 6:52 PM

Enhancing Team’s Productivity - .NET, VS.NET « Niraj Bhatt - Architect’s Blog said:

Pingback from  Enhancing Team’s Productivity - .NET, VS.NET  « Niraj Bhatt - Architect’s Blog

# January 30, 2009 12:00 AM

Eddie Garmon said:

Only if this didn't cause Studio to crash and burn. R# 4.1 the culprit? Or Silverlight tools for Studio?

# January 30, 2009 11:38 AM

Fossmo said:

Great tip. :-)

# January 31, 2009 3:52 AM

Stephen said:

Awesome! Thanks for the tip! :)

# February 1, 2009 3:01 AM

Fortnum said:

WOW! It really speeds up VS XAML! Many thanks!

# February 1, 2009 11:03 PM

Nick Harewood said:

Unfortunately I'm guessing I have had the same problem as Eddie above - Opening a xaml file causes VS to die within a couple seconds... Event Viewer gives me the following:   .NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (6C745E00) (80131506)

# February 4, 2009 10:29 AM

Fabrice Marguerie said:

Nick, are you using ReSharper as well?

# February 4, 2009 2:55 PM

Nick Harewood said:

No, though other devs on our project are... I haven't installed it as I don't do much code behind - mostly XAML (just fed up with Blend's limited syntax and editing capabilities)

# February 5, 2009 9:11 AM

Fabrice Marguerie said:

Do these other devs on your project have the problem?

Do you have SP1 installed?

# February 5, 2009 1:13 PM

Dean Chalk said:

I cannot tell you how happy this post has made me - many thanks

# February 6, 2009 11:02 AM

Fabrice Marguerie said:

A beer will be enough to thank me ;-)

# February 6, 2009 12:10 PM

Scott Marlowe said:

Awesome tip! Thanks.

# February 9, 2009 10:35 AM

Kirill Osenkov said:

If you use WPF/Silverlight and prefer working with XAML only (i.e. no visual designer), you can significantly,

# February 23, 2009 6:12 PM

jj said:

i can't find "Always open documents in full XAML view" in "Tools | Options | Text Editor | XAML | Miscellaneous" in my Visual Studio 2008 SP1.

# February 23, 2009 7:09 PM

Fabrice Marguerie said:

jj, what do you see then?

Do you have a special edition of VS 2008? Is it VS Express or something?

# February 23, 2009 8:23 PM

Bruce Johnson's SOA(P) Box said:

If you use WPF on a regular basis, then I can take a good guess as the esteem in which you hold the designer.

# February 28, 2009 1:41 AM

Jerónimo Milea said:

I don't think i can thank you enough!!! :D

# April 15, 2009 7:54 AM

Fabrice's weblog said:

Does your Visual Studio 2008 SP1 crash when you open some XAML files? It started to happen to me, for

# May 11, 2009 12:44 PM

Fabrice Marguerie said:

If you experience crashes when editing XAML files, the following hot fix may help:

weblogs.asp.net/.../fix-for-visual-studio-2008-crash-with-xaml-files.aspx

# May 11, 2009 12:45 PM

Warren said:

Thank god. You rock!

# May 15, 2009 11:30 AM

Kirill Osenkov said:

Thanks ever so much! I was using VS on another machine and was reminded how slow the XAML editor is without this tip!

# August 8, 2009 3:48 PM

MD said:

This tip is great!  Thank you for saving my sanity!

# September 1, 2009 2:44 PM

Jason Gray said:

Thanks. You just saved me from punching my monitor!

# September 2, 2009 3:49 PM

Troy said:

Am I the only person that this fix did NOT work for?

# October 29, 2009 10:16 AM

Fabrice Marguerie said:

Troy, what do you get? Errors?

# October 29, 2009 10:35 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)