Bug in VS 2022 (Enable XAML Designer not working) - wpf

I recently started to use Visual Studio 2022 Professional edition. Whenever I enable visual designer from :
Tools -> Options -> XAML Designer -> General
I check to enable the XAML designer:
When I restart the Visual Studio IDE, nothing is changed, and the option is unchecked again. I tried multiple times, and unfortunately, the XAML code is only visible while the XAML designer is always unchecked.

Hey I was having a similar issue.
Make sure you're opening the project via the actual C# project file and not through the folder explorer.

Related

Visual Studio 2019 Xaml Editor: Project Code button is disabled

Throughout my project on every xaml file the Project Code button in designer view is disabled.
What could be possibly causing this?
screenshot
Derive from Note in document To disable project code in the designer
For projects that target ARM or X64 processors, Visual Studio cannot run project code in the designer, so the Disable project code button is disabled in the designer.

Visual Studio 2017 Live Visual Tree shows empty for WPF

I installed VS 2017 v.15.6.3 and trying to debug a WPF application (running Test method to start WPF instance in same solution with attached process). Live Visual Tree shows blank and returns no result. I couldn't select any control to view in the visual tree. Any help would be appreciated.
Note: I checked all options under Enable UI debugging Tools for XAML and valdiated XamlDiagnostics.DLL in the machine.
Visual Studio 2017 Live Visual Tree shows empty for WPF
I do not think Visual Studio support Live Visual Tree for test project even if it start WPF instance in same solution with attached process.
The application should be WPF for Live Visual Tree to work.
So, to get the Live Visual Tree, please debug the WPF application directly.
Hope this helps.

Object reference exception when drag and dropping from toolbox to Windows Forms designer

When dragging a control from the toolbox and dropping it in the Windows Forms designer, a message box appears with the message Object reference not set to an instance of an object.
After closing the message box, I can drop the control on the form without any other issue.
This happens on a new project as well. The error appears in both VS 2015 and 2017 (both community editions).
EDIT : This happens on any control, including custom ones. This started happening after I updated to the latest version of Windows 10 (17134.48).
Instead of dragging and dropping, Clicking on the control, then clicking on the form is the workaround working for me until they come out with a newer update.
This is new behavior as of Visual Studio 2017 Version 15.8.6 for me.
Hopefully this will help others that just kept dragging and dropping over and over like I was doing :-)
Experiencing the same issue on Microsoft Visual Studio Community 2019 Version 16.5.0. I found that I was not able to drag and drop controls while VS was open on my high DPI external monitor, but if I moved VS to my native laptop monitor, I was able to drag and drop the controls.
For Visual Studio 2017 I did not fix the problem, but I found a workaround:
went to C:\Users\user.name\AppData\Local\Microsoft\VisualStudio\15.0_e3603226
deleted all *.tbd, privateregistry.bin*, ApplicationPrivateSettings.xml files
deleted all files in ComponentModelCache folder
restarted Visual Studio as Administrator
it showed a message of updating the MEF files
drag and drop is NOT working. It keeps throwing the same error
BUT I can click on the item I want in the toolbox and then click on the designer without dragging and it works.
For Visual Studio 2015 I did not fix the problem, but I found a workaround:
went to C:\Users\user.name\AppData\Local\Microsoft\VisualStudio\14.0
deleted all *.tbd, *.lock, devenv.exe.config files
deleted all files in ComponentModelCache folder
restarted Visual Studio as Administrator
drag and drop is NOT working. It keeps throwing the same error
BUT I can click on the item I want in the toolbox and then click on the designer without dragging and it works.
I have also seen the same problem repeated today in Visual Studio 2019 (Today is June 27 2019). I am trying out the VS 2017 solution from CristisS (above). I have verified that the 'workaround' still throws the exception, however, you can immediately draw the tool onto the form.
I repeatedly run into the same issue. Seems to always be caused by running the Windows Forms designer on my secondary monitor. I don't know what causes it to misbehave, but moving Windows Forms Designer window back to my laptop screen always fixes the issue. Idk if it has something to do with scaling, or what, but it is a very repeatable issue that needs to be addressed.
Moving Visual Studio over from my hi res secondary monitor to my primary laptop monitor did fix the issue.
To use Visual Studio on my larger secondary monitor, I set my secondary monitor from 3840x2160 down to 2560x1440 and set scaling from 150% down to 100%
This lets me Drag and drop from the toolbox to the designer in Visual Studio 2019 (V16.11.3) without issue again.
I found two solutions, to this problem that they worked for my WPF project in VS2015
solution 1) Click on the icon "enable/disable project code" in the bottom of windows design(the last icon near the percentual of zoom)-->Put Disable.
solution 2) Dx mouse button on your file .xaml and apply your modify in blend , selecting the "Open in Blend..." menu.
That's all
Daniel.

VS 2013 Ultimate: Add new Elements, Windows Form missing

When creating a new project I can select a new Windows Forms Project. It will open me a new project with a new windows form. When right clicking my opened project and going for add => Windows Form it will only open the "new element" mask, where Windows Forms, WPF and other templates are missing.
I already tried Visual Studio C# Can't make new windows form project devenv /installvstemplates, but it didn't work out telling me the templates were missing.
The following files were passed with the commandline:
\installvtemplates
These files were not found and could not be load.
What do I have to do, to get my WinForm templates back and where can I configure those? I can not just reinstall Visual Studio 2013 Ultimate, because I do not have an installation medium nor they key (Like nobody in my company can tell where to find it).
In the screenshot below you can see the mask, where I used to have a lot more templates. In this case we only have Inherited Forms and Inherited User Control as avaliable templates.
This is what I get when I go for new project, Windows Forms is avaliable here.
( Win Forms Objects not avaliable )
The template files are avaliable at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\VisualBasic so I am pretty sure it has to be an option somewhere in the settings. Any ideas?
After a few hours of trying I found a solution myself. It might not be the official way, but it seems to be working. I did the following steps:
Go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\VisualBasic and check if the templates are avaliable
If they are avaliable copy the directory Windows Forms
Paste the copied directory to C:\Users\%USERNAME%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual Basic
Start Visual Studio
Go into a project and try to add a new element. This step will take a while loading. I think visual studio now detects the new templates in your documents folder and refreshes all templates.
When it has finished loading you will see almost all templates twice. That's good news!
Close Visual Studio and delete the directory in C:\Users\%USERNAME%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual Basic\ we just pasted.
Restart Visual Studio
Profit
Tested on Windows 10 / Visual Studio 2013 Ultimate

Unable to add WPF controls to the toolbox in Visual Studio 2013

First of all, I am completely new to Visual Studio, so please don't be too judgmental. I have a project I need to do in C# for my studies and my team uses a GitHub repository. I am in charge of creating the GUI and I am stuck at the very beggining.
I want to create the main application window using WPF, but when I use toolbox > choose items, I can not see the WPF tab. Also, when I am trying to enable the designer view, nothing happens.
Is it perhaps the software version being Visual Studio Community 2013 causing the issue? Do I need to have the Visual Studio Professional version in order to use WPF toolbox?
I'm attaching a link to the screen of the situation below.
As I presumed, all I needed was the professional version of Visual Studio. After obtaining and installing it everything works fine.

Resources