How to manually reload the Visual Studio designer for WPF

I'm a little late but this is the best solution1 I've found so far: whenever the designer does stupid stuff, I just kill it's process.

Press Ctrl+Shift+Esc
Navigate to the Processes tab.
Kill XDesProc.exe

This also fixes issues for the properties window (like when it gets jammed and you can't type stuff into it).

1 This is a solution for designer issues. Your issues may also be caused by compilation problems, in which case just right click on the solution in the solution explorer, and clean it. The reason behind it is that sometimes the compilation loses synchronicity with the generated files from XAML, and cleaning the solution just deletes those intermediate files; it's like a reset so your compilation can start off with a clean slate.


To do it fast:

Comfortably it's usually the last one if sorted alphabetically.
When it is, it's almost like a ritual for me to quickly pop up the task manager, click any process, press End, Delete, Enter (done), Esc (exit task manager). Instead of restarting VS and waiting for all the loads & unloads, you can do that in 1-2 seconds.


You can add this to the Tools menu in Visual Studio.

Once configured, use Tools..XAML Designer Restart:

Alt+T then L

enter image description here

enter image description here

I tried configuring it for Alt+T then X but this clashed with Tools..Choose ToolboX Items.

Update

These days, I prefer to just hit Ctrl+Shift+Esc to bring up the process manager, then X to skip to XDesProc.exe then Delete to kill the rogue process(es).


In newer versions of Visual Studio there is an icon on the bottom of the designer to "Disable Project code". If you toggle this off and on it will reload the designer.


The Visual Studio designer attempts to keep the rendered view in sync with the XAML. That's the advertised behavior.

  • The first thing you should check is that there are no errors in the errors window. It may be something as simple as a missing angle bracket.
  • The second thing to check is whether you have any code (other than your code-behind) which needs to be compiled for the designer to render your XAML correctly. This includes any of your own datatypes that you instantiate in XAML, any custom controls you have written (e.g. MyTextBlock derived from TextBlock), or any classes directly or indirectly in support of design-time data. If so, you need to rebuild your project.
  • The last thing to check for is possible bugs in the designer. In spite of the advertised behavior, the designer may get out-of-sync due to bugs. In that close, close the XAML window and re-open it. Other tricks that might work are selecting the XAML tab and then the Design tab, or maximizing the XAML pane.

As far as rebuilding your application goes, you don't need to do this as a habit. You only need to recompile it when the above conditions apply. Once they don't apply, you can just edit the XAML. Another way to say this is that if you haven't modified code, you shouldn't need to rebuild (modulo bugs).


I'm not sure, but I think a build will refresh your view in that situation.