I know it would be harder, and probably pointless, but I am just wondering if it is possible to open a window in C# without XAML. For example, something like: Window win = new Window(); win.Show();
XAML is the mark up language for the window, just like HTML is the mark up language for DOM.


Would you rather code like this:
…or like this:
Just saying ¯_(ツ)_/¯
There is an alternative style that merges both worlds:
It is, and Charles Petzold’s book “Applications = Code + Markup” walks through it in one of the chapters.
But it’s so insufferably tedious I don’t think anyone would do it. Since so much of WPF is templated, I remember the object graph getting pretty strange.
Interestingly, part of the big releases next year include an MVU framework for (I think) MAUI. This framework doesn’t use XAML for UI, instead it has a new API in C# for defining the UI and setting up bindings. A lot of people seem to like MVU so I’m interested in how it turns out. My understanding is Comet is a good idea of what it might look like.
Yeah I was just wondering because, I know you can make the XAML elements in C#, and I was wondering if it works like that for a window as well. Thank you.
I can’t fathom why you’d want to design and/or implement a GUI in a language that wasn’t purpose-built for building a GUI.
Its not pointless at all. In some cases it is a simpler solution but it depends on the situation. Your code example would work.
Yes
C# devs
null reference exceptions

source