Videogamers0 / MGUI

UI framework for MonoGame game engine.
MIT License
67 stars 8 forks source link

Question: Designer? #4

Open lucid2310 opened 1 year ago

lucid2310 commented 1 year ago

I wasnt sure how to contact you directly, I am trying to design the layout of my UI using the xaml designer in visual studio 2022, but visual studio is having some issues and puts a message "SomePage.xaml cannot be edited in the Design View." I was wondering if there were any tips to get this working? Or if you have any suggestions on a good designer, I am all ears! Thanks! I see on your profile you are in Florida, nice I am in Palm Bay / Melbourne area myself.

Videogamers0 commented 1 year ago

Sorry, Visual Studio's designer doesn't work with MGUI and I'm not sure if it'd even be possible to get it working since would involve an entire MonoGame process inside it. The Visual Studio XAML editor is still useful for various intellisense like autocomplete or syntax highlighting.

If you're working on a simple UI, then in my opinion the best approach is to use the MGXAMLDesigner control. If you run the Samples project, the Compendium window has a 'XAML Designer' window under the Dialogs section. Open that window at runtime, and browse for a file with the 'From File' tab. I usually edit my XAML in Visual Studio's XAML Editor (to utilize the autocomplete/syntax highlighting etc), then click the Refresh button on the MGXAMLDesigner control to see how it looks. The MGXAMLDesigner doesn't support DataContexts yet but would probably be a simple feature to add, or you could just hardcode a DataContext in MGUI.Core.UI.MGXAMLDesigner.RefreshParsedContent() while working on a dialog.

Of course, even with the above approach you'll still only be able to see how the result looks. There's no properties window or anything that lets you manually place controls with the mouse cursor etc. I probably could add some kind of properties window to the MGXAMLDesigner control though.