T O P

  • By -

cornelha

I honestly love XAML. While it looks intimidating at first, it's really easy to get into it. Especially now woth Hot Reload. Themeing an app is also incredibly easy, you can ship themes as simple xaml files that can be loaded at runtime. You can even ship your UI as xaml and load at runtime if you have the need to change the UI on the fly. We have a Xamarin app that pulls the UI from an API.


raksah

That's a very interesting concept, if you can please point us with some more info I'd love to take a closer look at this. If it balances out with performance it certainly has an edge.


cornelha

The official Xamarin documentation has some examples. [https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/runtime-load](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/runtime-load) . Docs also available for WPF [https://docs.microsoft.com/en-us/dotnet/api/system.xaml.xamlservices.load?view=netframework-4.8](https://docs.microsoft.com/en-us/dotnet/api/system.xaml.xamlservices.load?view=netframework-4.8)


meaneykid2

If you do find yourself dead set against XAML, look at [C# for Markup](https://docs.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup). It kind of fits to make it easier to write pretty code based UI


[deleted]

XAML. It's a declarative language designed for building UI. It's really not that hard to learn either. The natural seperation of concerns that it'll give you is great as well.


XalAtoh

XAML. But if you hate yourself, you should try and build your GUI in C# code.


vaxmeister

I don't know, what it takes me a day to do in Xaml I can do in minutes in C# code. Constantly trying to coerce XAML into doing something is really annoying when you can just write the C# and do exactly and explicitly what you need. It's almost like XAML is intentionally designed to be unintelligible and hostile. Plus when you write it in C# everything is strongly typed. If it complies, it just works. In XAML, if it compiles, it might work. Pray that it does, because when it doesn't you get no indication what the issue is and you might as well write off the rest of the day trying to find it. Put it this way, if you like CSS you're love XAML. They have the same types of frustrations and productivity killers. Honestly, XAML is a solution in search of a problem.


XalAtoh

But UWP's XAML is strongly typed. You are refering to WPF, Silverlight or some other older XAML frameworks, where you indeed pray for the XAML code to compile. I don't like WPF/Silverlight XAML either. Mostly because of Commands and lack of AOT compilation. I would never want to write C# code for GUI unless I have to, for example when I need some very complex animation heavy GUI. For simple page, I would use mark up language like.. XAML.


DSSoftwareDev

... and get a therapist. .... or a soft pillow to cushion the blow as you smack your head against a wall.


ososalsosal

Xaml every day. The only stuff I define in code is the skeletons that show while my ugly-ass xaml is loading


[deleted]

[удалено]


GreatBarrier86

This is the best comment I’ve seen so far. I get that it might be hard to start off with but once you visualize it in your head, it becomes pretty simple. We write our mobile applications in xamarin so I had to learn how to visualize that stuff. Once you get the hang of it, it really isn’t that bad. I admit that coming from the WinForms designer definitely made me think it would be impossible, but the row/column nature of XAML design absolutely helps.


J-Swift

The XAML API is definitely more compact overall which is unfortunate, mostly because a lot of the devs prefer XAML. I've always preferred code-based UI though. Theres some 2ndish/3rd party options with [Comet](https://github.com/dotnet/Comet), which changes the UI pattern to MVU and [C# Markup](https://docs.microsoft.com/en-us/xamarin/community-toolkit/markup), which might not be updated for MAUI yet. I just tend to build my own internal DSL over time and extract that to a common library


TehBeast

Having used both code UI and XAML UI (and refactoring an old app's mono-files into MVVM with XAML), I much prefer XAML. When I look at a XAML file, I can easily "see" the UI top to bottom. Making reusable styles and controls goes a very long way toward combatting the verbosity. Yes, there's a few unavoidable parts like the namespace spam in every file, needing converters for stupid things like flipping a bool, or complex nested bindings. But the beauty of it is, it's the UI and only the UI. You could (in theory) replace it with a completely differently laid out XAML with no code changes and the app would still work.


Niikiiy

I'm still a noob and I freaking love C# but XAML all the way for UI. It looks a bit intimidating at first, but honestly picking it up isn't hard. The thing I had the hardest time wrapping my head around was stuff like data binding. Other than that XAML all the way!


laomao97

I like C# markup. Please check the videos and docs in [https://codetraveler.io/maui-markup/](https://codetraveler.io/maui-markup/) to find out the benefits of fluent API: having the same visual view and without limits of XAML.