Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually reload the Visual Studio designer for WPF

Is there any way to force the WPF designer to reload or refresh, without rebuilding the entire project or solution?

If there's an error, I get an option in the designer view to refresh the designer. But if I don't have an error, how can I get the designer to refresh after I've made a change?

like image 567
dthrasher Avatar asked Sep 16 '10 17:09

dthrasher


People also ask

How do I enable hot reload in Visual Studio?

On Windows, check the Enable XAML Hot Reload checkbox (and the required platforms) at Tools > Options > Debugging > Hot Reload. In earlier versions of Visual Studio 2019, the checkbox is at Tools > Options > Xamarin > Hot Reload.

What is XAML hot reload?

With XAML Hot Reload, you can incrementally build and test XAML code for your WPF and UWP apps. You can do so with the benefit of the running app's data context, authentication state, and other real-world complexity that's hard to simulate during design-time.

How do I open XAML Designer in Visual Studio?

To open the XAML Designer, right-click a XAML file in Solution Explorer and choose View Designer. to switch which window appears on top: either the artboard or the XAML editor.


2 Answers

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.

like image 104
MasterMastic Avatar answered Sep 30 '22 09:09

MasterMastic


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).

like image 35
Contango Avatar answered Sep 30 '22 10:09

Contango