I interrupt my ongoing series of Nuget tips to bring you the following public service announcement.

After working on a WPF app for the past year or so, I have come to realize that no one on our team uses the XAML designer surface that ships with Visual Studio.  We all find it much faster to edit the XAML by hand, break up the XAML into manageable chunks, and generally stay away from the designer.

We also all notice that Visual Studio grows to consume large amounts of memory and locks up to a (Not Responding) message on a semi-regular basis.

This week a colleague showed me a couple of tricks to disable the XAML designer surface and squeeze a bit more performance out of Studio.

1. Default to full XAML view

Prior to this week our team had all done the obvious thing and told the XAML editor to default to XAML view, hoping that if we never opened the Designer view that would improve things.

In the Tools –> Options menu, open the Text Editor node, then the XAML node, then select the Miscellaneous node; make sure that under the Default View heading there is a checkbox beside Always open documents in full XAML view.

This got us part of the way there, with the code view opening by default when we opened XAML files, but Studio still locked up quite often.

2. Kill the designer rendering process

It appears that Visual Studio spawns a background process to render XAML for the Design tab of the default XAML editor so that it is ready to show on the design surface. 

Open the Task Manager, right-click on XDesProc.exe, and select End Process.

This process seems to start up whenever you open a XAML view in Visual Studio whether you ever click on the Design tab or not, which leads to the latest suggestion.

3. Open as source code

In order to prevent the designer from ever getting loaded, you can tell Studio to use a different editor entirely when opening XAML files.

Right-click on any .xaml file in your solution explorer and select Open With…

When the Open With dialog opens, you can pick anything you like as a default editor for XAML files.  The XAML UI Designer and XAML UI Designer with Encoding will both trigger the XDescProc.exe process to start up in the background, but the numerous other editors will not.

On our team we use the Source Code (Text) Editor.  Not only does it avoid slowing us down with the XAML UI editor, but it provides all the rich intellisense-supported goodness of the XAML tab from the default editor.  In short, our experience of editing XAML files is the same as when we tried to stay in the XAML tab of the default editor.

To do this, pick the Souce Code (Text) Editor and click Set as Default.

Happy XAML editing!