Speed up WPF XAML Editor in Visual Studio 2012

Tired of the stupid XAML editor being so slow. Mine freezes, locks up and is otherwise unruly. I didn’t seem to have a choice if I wanted intellisense in Visual Studio before 2012. Well, apparently they fixed the source code editor in 2012 to have working intellisense so there is now a viable option for ditching the buggy standard designer view.

Yes, even if you are in the XAML tab full screen, the stupid designer is still working and crunching on everything you type and blowing its lid at all your inflight incorrect changes.

How do you fix it, easy. Right click your xaml file in the Solution Explorer(filename, not the file contents) and choose Open With…. Pick Source Code Editor. Click the use as default option. Hit ok.

Done. Enjoy not wanting to throw your computer after losing your changes repeatedly due to the designer full on crashing.

Happy Coding!

Want pictures, its the last section of this guys entry. Good reading. The first two were what I had used before since the third wasn’t viable before 2012.

http://blog.spinthemoose.com/2013/03/24/disable-the-xaml-designer-in-visual-studio/

How to add a picture to a worksheet in Word and Excel using VSTO with c# and autosize

Here is a really simple example of adding a picture without really needing to know the dimensions of the image. Excel uses points which is pretty annoying, since pics are in pixels….duh… I put in the sizes for my pics, but you could use any number since we repair it with the scale calls. Anyway, here it is. Word vstoDoc is my document.

[csharp]
//push resource to disk.
var path = Path.GetDirectoryName(vstoDoc.FullName);
var fn = Path.Combine(path,"rfn.png");
//insert the fun fact box at top.
var pic = vstoDoc.Shapes.AddPicture(fn,false,true,5,5,455/1.0,162/1.0);
pic.Name = ROLLFORWARDSHAPENAME;
pic.ScaleHeight(1, MsoTriState.msoTrue);
pic.ScaleWidth(1, MsoTriState.msoTrue);
[/csharp]

Here is Excel. vstoSheet is my Worksheet. I loop through them to add pics.

[csharp]
//push resource to disk.
var path = Path.GetDirectoryName(vstoDoc.FullName);
var fn = Path.Combine(path,"rfn.png");
var pic = vstoSheet.Shapes.AddPicture(fn, MsoTriState.msoFalse, MsoTriState.msoTrue, 5, 5, 231 * 72 / 96, 317 * 72 / 96);
pic.Name = ROLLFORWARDSHAPENAME;
pic.Locked = false;
pic.ScaleHeight(1, MsoTriState.msoTrue);
pic.ScaleWidth(1, MsoTriState.msoTrue);
[/csharp]

Happy Coding!