20

I've just installed VS 2022 preview to use Maui but there seems no way to see a designer view of the XAML, I want to drag and drop controls onto the page but all I get is an ancient looking XAML text view.

Paul
  • 319
  • 1
  • 2
  • 3
  • 2
    Does this answer your question? [xaml designer or previewer is not showing](https://stackoverflow.com/questions/66798114/xaml-designer-or-previewer-is-not-showing) – Cfun Jan 24 '22 at 07:27
  • 5
    No, it can't be the answer, because that would mean MS removed the ability to design the UI, you can't design a UI using hot reload that would be madness. The answer can't be to use the text editor as that's like jumping back in time 30 years. – Paul Jan 24 '22 at 08:08
  • But it was working in some previous version of VS preview. My god! – Juan Ignacio Avendaño Huergo Mar 08 '22 at 16:40
  • Following various threads on this: yes the designer is gone for MAUI and WinUI. any idea on where to start a petition to get it back? – lkujala Dec 07 '22 at 19:13
  • Also see [XAML Live Preview](https://learn.microsoft.com/en-us/visualstudio/xaml-tools/xaml-live-preview?view=vs-2022#xaml-live-preview-window), which is now supported by Maui. Its a VS window based on Hot Reload. It still isn’t a drag-and-drop visual designer. Maybe the plan is to become that? I see rulers. – ToolmakerSteve Jun 28 '23 at 03:52

3 Answers3

7

Visual Studio has removed the XAML designer. For now, there is no official plan to readd it.

But Visual Studio support Hot Reload to modify your apps managed source code while the application is running, without the need to manually pause or hit a breakpoint. You could preview the view at runtime when you change the UI. For more details, please check the blog. https://devblogs.microsoft.com/dotnet/introducing-net-hot-reload/

Like Cfun said, you could use live visual tree as well. It shows a tree view of the UI elements of your running Xamarin.Forms application. https://learn.microsoft.com/en-us/xamarin/xamarin-forms/xaml/live-visual-tree

Wendy Zang - MSFT
  • 10,509
  • 1
  • 7
  • 17
  • 3
    "Visual Studio has removed the XAML designer" -Thats a lie, in WPF, i still have the XAML Designer. – Schecher_1 Jul 12 '22 at 21:09
  • 3
    there is a MAUI example project that has multiple different UI projects. I tried the designer in each project type. designer works in these projects (wpf, uwp). designer does not work in these projects (winui, maui, avalonia, xmarian). this was an unexpected "gotcha" when migrating from winforms apps. the usual microsoft dance; one step forward, ten steps back. – lkujala Dec 07 '22 at 00:42
  • Wendy - Please see https://developercommunity.visualstudio.com/t/MAUI-XAML-Designer-and-editor-not-workin/1589956?stateGroup=active&ftype=idea&q=designer&sort=votes to understand why many of us will not view this as an acceptable solution / workaround. – Stevie White Jan 30 '23 at 06:15
  • @Ikujala: FWIW: Some history. Xamarin.Forms has existed since 2014, and never had a visual designer. Recall that it was not developed at Microsoft; the engineers didn’t have access to Visual Studio’s WPF visual designer source code. And it was primarily cross-compilation to Android/iOS, not native Windows. Its not like someone decided to "remove visual design". I don’t know why this never became a priority in the cleanup of XF to become Maui, but StackOverflow is not the place to try to get it fixed. Open an issue at https://github.com/dotnet/maui/issues. – ToolmakerSteve Jun 28 '23 at 04:10
  • Hmm. I just saw that you also tested WinUI, and its missing from that also. Even though it worked for UWP. That’s more surprising to me, since WinUI 3 is an evolution of UWP’s WinUI 2. Logically, it should exist for WinUI 3. And then that could be used as basis for Maui’s designer when targetting Windows. – ToolmakerSteve Jun 28 '23 at 04:30
2

For a WPF dotnet6 project, the XAML designer can be enabled here:

enter image description here

Don't know why it's disabled by default.

zwcloud
  • 4,546
  • 3
  • 40
  • 69
  • 3
    The question was for MAUI, which does not show XAML Designer even when enabled. But this is good information if you are searching for WPF and happen across this post. – tbear Nov 13 '22 at 17:58
0

Try to use context menu of *.xaml file and open it in Xaml designer ("Open With..."), if it works you can set that behaviour as default.enter image description here

Artemy
  • 229
  • 2
  • 5