Search code examples
c#wpfvisual-studio

App.xaml cannot be edited in the Design view


I have been working on a .NET 6 WPF application using Visual Studio 2022 v17.6.5. For some reason, at a random point during development, when I tried to open the App.xaml file to add some Dictionaries I started getting this message:

App.xaml cannot be edited in the Design view.

screenshot

Cleaning and rebuilding did not solve the issue.

I can still open and edit the file in other IDEs or text editors, but not in Visual Studio.

I have looked on the Internet to see if this was a common issue and I could not find anything useful. Does anyone know what's causing this and how to fix it?

Thank you in advance!


Solution

  • This is because you accidentally closed Enable XAML Designer(requires restart of Visual Studio)

    Here's the App.xaml that opens when Enable XAML Designer is closed (requires restart of Visual Studio):

    enter image description here

    Please follow the steps below to enable Enable XAML Designer (requires restart of Visual Studio):

    Tools => Options => XAML Designer => General => Check Enable XAML Designer(requires restart of Visual Studio)

    enter image description here