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

Tuneo

ASP.NET Hosting transatlantys

Contact

Me

Others

Selected content

Archives

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

Kunal Shetye said:

Thanks for this Awesome tip!

Saved me a lot of time :)

# January 29, 2009 12:32 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

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

fwh said:

Great! And it works with RockScroll too. Thanks

# January 29, 2009 6:52 PM

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

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

Jerónimo Milea said:

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

# April 15, 2009 7:54 AM

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

Carsten Grünzner said:

An outstanding tip! I think you speed me up more than 200%.

# December 9, 2009 11:00 AM

Snowy said:

I am a long-time Winforms dev who is getting into WPF. I'm using the freebie VS2010 Express and was dismayed (and somewhat alarmed - I will have to use this in future!) at how painful dealing with XAML and the designer was.

In winforms, switching between the code and the designer was instantaneous, but it seems in WPF designer it reparses the XAML every time a switch is done. EEEkkk!

This fix preserves my sanity and (somewhat dimished) faith in VS, which I have been using in its incarnations over many years... thank you!

# January 19, 2010 9:12 PM

prakash said:

fantastic tip.

# January 22, 2010 3:32 AM

Syed Shah said:

Thanks for you life saving tip. It really is.

# January 29, 2010 11:35 AM

Anand Subramanian said:

Fantastic...you do not know howmuch heartache you have saved. Thanks a ton.

# January 29, 2010 11:40 AM

Stephen Ellis said:

Oh, you've saved me from a stroke! Thanks so much.

# February 8, 2010 7:24 AM

Pieter said:

Fabrice, you are my HERO !!! I will name my first born after you !!!! :)

# March 10, 2010 6:26 PM

Fabrice Marguerie said:

lol

# March 10, 2010 7:04 PM

Pakeeru Shaik said:

Super Tip, it saved me from restarting the VS2008 more than several times a day. Its indeed a life saving tip. I really appriciate it.

Thanks

Shaik

# April 14, 2010 5:14 PM

him said:

It does change the life for faster, but don't you like the convenience of intelli-sense designer ?

# May 5, 2010 3:03 PM

Fabrice Marguerie said:

> don't you like the convenience of intelli-sense designer

Yes I do like IntelliSense, and that's why I'm happy with this solution: IntelliSense works with it, as I wrote.

# May 5, 2010 4:25 PM

Dmitry Lyalin (MSFT) said:

Thanks for the excellent tip! This will save me a lot of time going forward, should have used this trick 6 months ago lol.

# May 13, 2010 2:06 PM

Arek said:

Fabrice, you can only imagine how greatful I am for this tip after at least few hundred crashes of VS 2010 because of this f.. XAML designer. Thank you very much!

# May 19, 2010 3:19 AM

Sheze said:

Excellent tip ... thanks

# June 29, 2010 7:47 AM

Rajesh said:

Truely life changing... It was

Horrible!

Pathetic!

Don't know if anyone in Microsoft ever wrote even one line of XAML in this view...

I think they should fire the guy who made such a release..

And the irony is what you wrote for 2008 is still the same in 2010 ... two years and no one in microsoft is using the default XAML editor... is WPF/XAML the future or everyone in Microsoft is writing Winforms based applications or may be they are using a better editor from a better company....

Thanks a lot for an incredible tip...AWESOME!!!...

Cheers

Rajesh

# October 28, 2010 3:25 AM

Praveen said:

Thanks a lot. your tip simply rocks :)

# December 8, 2010 11:37 AM

Jacob said:

A life changing tip indeed.

Thanks.

# December 15, 2010 11:25 AM

Richard said:

This tip saved me a ton of time.

Thank you.

# March 17, 2011 10:27 AM

Michael Daly said:

Dude, big thanks!  I was HATING this slowness for months!

# June 29, 2011 6:18 PM

Sue said:

Thanks a lot, dude: simple and effective

# October 3, 2011 9:35 AM

Aravind said:

Awesome man! It works like heaven out of somewhere when i felt lost.

# October 27, 2011 3:46 PM

zm said:

I've wasted 2 years of my XAML life by not seeing this tip until now.

# February 2, 2012 3:21 PM

Thomas Levesque said:

It's not what I was looking for, but it's a great tip all the same. Thanks!

# May 25, 2012 1:08 PM