Problem solve Get help with specific problems with your technologies, process and projects.

How to speed up Visual Studio 2008's slow WPF designer

Large files can slow down Visual Studio 2008's designer for Windows Presentation Foundation (WPF) projects. Learn how to tweak VS 2008's settings to speed up its WPF designer in this tip.

Most developers I know are obsessive about managing their software workspace. When you spend countless hours sitting at your laptop creating software, the last thing you want to do is wait on your tools. From setting up keyboard shortcuts to installing your favorite utilities, you know just how to squeeze every drop of performance from your tools so that you can write code fast and furious. WPF developers are no different. Here are a couple tips to speed up the WPF tools in Visual Studio.

Speeding up the designer

Visual Studio supports a plug-in designer model. The .NET Windows Forms designer is a great example of a designer plug-in: when you open a Windows Forms file in Visual Studio, the IDE determines that the Forms class has an affiliated custom UI designer. The designer is loaded into an IDE tab, your code is parsed and the designer renders your UI. Any changes you make to your form, like dragging a button from the ToolBox to the design surface, causes the designer to update the code in YourForm.designer.cs as well as forcing an update to the UI.

WPF UserControls, Pages and Windows designers work the same way. When you open a XAML file, Visual Studio finds the matching WPF designer and loads your XAML into it. If you use this WPF designer for more than few days, however, you'll begin to realize that it is slow, especially when loading large files.

This is a well-known problem, and the WPF designer team at Microsoft (codenamed Cider) is making good progress toward fixing the problem. In the meantime, they have added a setting that makes it easy to speed things up by disabling the designer's normal WYSIWYG view and using the XAML view instead.

  1. Open the 'Tools-Options' menu.
  2. Select the 'Text Editor-XAML-Miscellaneous' node.
  3. Check the 'Always open documents in full XAML' view checkbox.

always open documents in full XAML view

Change the default XAML editor

The simplest change to make to speed up the loading of XAML files is to forget about using the WPF designer altogether. Instead, set the default editor for XAML files to the XML editor. You still get full IntelliSense support while editing XAML, but the load time for most files is dramatically reduced. Making this change is simple.

  1. Right-click a XAMLfile in the Solution Explorer.
  2. Choose the 'Open With…' menu item.
  3. Select the 'Source Code (Text) Editor' item and click the 'Set as Default' button.

open with XAML

open with XAML text editor

The disadvantage with this approach is that you no longer see the XAML/Designer tabs in the editing window. If you do need to work with the designer, choose the 'View-Open With' menu item, and Visual Studio will open the file in another tab.

XAML designer tabs

Walt has trained thousands of corporate developers during the last 14 years and he travels the world speaking at software conferences, and providing developer training for corporations. He writes for several IT magazines, and worked on books/videos and .NET courses for Microsoft Press. As a Wintellect consultant he is presently focused on the WPF, Surface and Silverlight APIs. Walt is also a Microsoft MVP, WPF Disciple, Silverlight Insider and author of the free Shazzam WPF Shader utility.

Dig Deeper on .NET Framework 3.5 and Visual Studio 2008 development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.