Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Within the WPF Designer, what does Enabling/Disabling Project Code do?

I have no clue how long this feature/option has been around but my mouse happened to pause over this button within the WPF designer early and now I'm curious what it's purpose is.

enter image description here

Hovering over the button, Visual Studio pops up a tooltip that says Enable project code. When I click on it, the designer seems to reload the xaml contents but I can't tell what's changed.

What does this feature do?

2020 EDIT

It's been years since I've had to work in XAML, but I've received a new project where I need to work in XAML. This feature/button seems to have disappeared. Where has it migrated?

like image 836
RLH Avatar asked Nov 03 '17 13:11

RLH


People also ask

How do I disable XAML designer?

In Visual Studio 2015/2017/2019/2022: In the Tools -> Otions menu, open the XAML Designer node, then uncheck "Enable XAML Designer"

How do I enable XAML designer?

To open this page, choose the Tools menu and then choose Options. To access the XAML Designer property page, choose the XAML Designer node. Settings for the XAML Designer are applied when you open the document. So, if you make changes to the settings, you need to close and then reopen Visual Studio to see the changes.

What is WPF code?

WPF, stands for Windows Presentation Foundation is a development framework and a sub-system of . NET Framework. WPF is used to build Windows client applications that run on Windows operating system. WPF uses XAML as its frontend language and C# as its backend languages.

What is WPF in Visual Studio?

Windows Presentation Foundation (WPF) and XAML combine into a rich presentation system for building Windows desktop applications with visually stunning user experiences that incorporate UI, media, and complex business models.


1 Answers

What does this feature do?

It enables or prevents the designer from running your code in the background.

Disabling project code can lead to a loss of design time data and enabling it can lead to unhandled exceptions in the XAML designer. These exceptions are usually caused by code that attempts to access properties or methods which work differently when your application is running in the designer compared to when it runs as a built executable.

Debugging or Disabling Project Code in XAML Designer: https://msdn.microsoft.com/en-us/library/mt622752.aspx?f=255&MSPPError=-2147217396

like image 200
mm8 Avatar answered Nov 16 '22 04:11

mm8