At this point I am convinced that the decision to define UI layouts in XML instead of code has been a terrible mistake.

- For starters, it's overly verbose. If you've worked with stuff like XAML in WPF or XML layouts on Android, you know how quickly those files tend to get bloated.

- It does not lend itself well to reuse compared to, well, actual code. Which means there tends to be a lot of repetition. Which leads to more bloat.

- Editing XML kind of sucks. You're more at risk of making silly typos that won't be caught at compile time.

- XML namespaces make an already verbose language even more verbose, not to mention just generally confusing.

- At some point you will need to access your user interface from your application code. Which means you end up with silly stuff like findViewById() to bridge the gap, adding even more boilerplate to your code.

- You essentially have to learn two different sets of APIs which do the same thing. vs button.setTitle("blah"). Why?

The only real strengths of XML are that 1) it's declarative, 2) it's hierarchical, and 3) it's diffable. But code can be too, without all of these other drawbacks.

Fortunately it seems like the industry is starting to figure this out with things like SwiftUI and Jetpack Compose. I really think we're going to look back in a few years and think it was ridiculous that we used to do this stuff in XML.

Its funny WinForms was just code. The designer generated the code or you code do it by hand.

You could read it and understand it because it was the same language you used. If there was a problem you could debug it.

I never felt more productive than when my UI declaration was just code.

Inevitably you need to mix some logic in the layout language and then debug it (For each render this thing, binding syntax etc.) now you have a weird programming language that is hard to debug and remember syntax for, or you could just use a normal programming language, maybe one that supports some declarative constructs.

SwiftUI gives me hope, would like to see something similar show up for the .Net World.

If you use F#, Fabulous[1] for mobile apps and Fable+Elmish[2][3] for web exist. I use Giraffe's[4] view engine for server-side HTML templating. And it looks like AvaloniaUI is going to have a similar style UI in FuncUI[5], but I'm not sure how active that is.

I'm not sure about any C#-focused efforts.

1: https://github.com/fsprojects/Fabulous

2: https://github.com/fable-compiler/Fable (transpiles F# to JS)

3: https://github.com/elmish/elmish

4: https://github.com/giraffe-fsharp/Giraffe

5: https://github.com/JaggerJo/Avalonia.FuncUI