I Rewrote WinUI to WPF
github.com
github.com
That's just revisionist marketing
It is worth noting that WPF can run on this latest version of .NET
FWIW it was only recently migrated to a modern .NET version, give the latest version a spin if you haven't already.
.NET apps can be published with AOT code (ReadyToRun). WPF apps are still pretty slow to launch with ReadyToRun enabled; I haven't profiled it to see why, but I suspect it has a lot more to do with WPF (somewhat abandoned for a decade, and the XAML bits have always been slow) than .NET.
In my experience the JIT penalty at startup isn't as bad as people think, the .NET JIT compiler is really fast and the average console app is very quick to start up.
I feel MVVM is an anti-pattern: it necessitates long-lifed mutable instance state (the object of the class of your view-model) which is much harder to reason about (for example, try updating a bunch of properties in response to another property getting updating), but for me, the worst part is the inability to differentiate or identify the source or origin of new data that appear in a property setter: it's very difficult to determine if a TextBox TextChanged event came from a user-initiated action, was set by another method in the class - or was a knock-on property change - because a property setter doesn't have an EventArgs parameter. This can cause ViewModel event-handlers to get caught-up in infinite-loops or at the very least sending large amounts of inconsequential and unnecessary event-messages around and invoking (potentially expensive) property-setters and getters. I still agree that MVVM was a huge improvement over simply subclassing widgets and windows like we do in WinForms, VB6, Delphi, and JWT/Swing - but all MVVM brings you is separation between UI and Business/Domain in name-only; your ViewModels are still inevitably going to end-up with dozens of new properties bound to sone arbitrary presentational XAML attributes.
XAML alone is a decade past it’s time. It’s hugely verbose and is filled with so many gotchas (wanna bind a bool property to a control’s visible/hidden state? Not without an extra 50+ chars of binding params and value-converters). XAML also falls for the pitfall of assuming a GUI can always be modelled as a strict hierarchy of containers and controls.
Overall, XAML feels like what the Microsoft of the mid-to-late 1990s wanted to turn HTML into.
———
I hope I don't sound like another React fanboy (and I personally use Redux, not React)- and I'll argue that modelling state as a history of immutable, almost serialized, state trees is fantastic for so many things - especially typical database/business application work, but it's also utterly inappropriate for so many other kinds of applications (like, you wouldn't serialize the entire state of a raster image of HTML <canvas>, or re-run an append-only list of drawing instructions (like PostScript/Windows Metafile) for Canvas 2D context or even WebGL - BUT overall the Reflux/Redux/React design of a strict one-way flow of data and state brings so much clarity and makes it easy to see how different components (even in an abstract sense) interact with each other: they don't! It really does force you into a better way of thinking about program code, state and flow.
——
Not that it matters: Microsoft has completely dropped the ball on keeping the Win32 desktop dev-story alive. WinForms is uncool and terrible but there is no faster alternative for putting together a quick simple form in an EXE. If you use WPF you’d still be trying to get MahApps working,
-----
> Web UI frameworks were barely in existence and webpages typically didn't have that desktop-y/SPA feel. WPF was king for a while until web took over
2005-2006 was after the start of "Web 2.0" and after AJAX had been established - but mostly: when Firefox had already been out for 2-3 years and for that companies that were willing to go all-in on Firefox for their users, they really could have have desktop-quality SPAs made using Firefox's massively superior support for modern CSS techniques that IE6 had avoided for over 5 years at that point - can you imagine Google not releasing a Chrome update for 5 years?
So it was IE6's fault that better SPAs weren't around on the Internet - but it was also IE6's fault that so many companies had the 1990s near-equivalent of an SPA: ActiveX-heavy intranet sites that only worked in IE6. That point amuses me.
- https://redux.js.org/style-guide/style-guide#model-actions-a...
- https://redux.js.org/style-guide/style-guide#put-as-much-log...
- https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-ta...
In most projects I've worked on using Redux or Redux-style patterns (which, I'll admit is not a large number), keeping the separation didn't improve things, instead it added to more "fiddliness" and yo-yoing between files in the editor/IDE - this is especially the case when a project is iterating through changing project-requirements, especially for trivial actions/reducers. This only applies to cases where actions had a 1:1 mapping to reducers - and the bundled funcs were strictly pure-functions too, of course.
But I stress that I'm not a Redux expert (blame my lack of experience) so I appreciate that I almost certainly have done something wrong, so I'd love to be able to have a Redux expert on-call who I could just ping on Slack and pose a very domain-specific question to and ask "what is the Redux-way(TM) of doing this?" instead of having to try to go through the very abstractly written (often past the point of comprehension) pages of official documentation, blog articles and the like and hope I'm doing things correctly (especially in non-JavaScript environments).
----
Obviously the biggest barrier to the adoption of the Redux-pattern in non-JS environments is other languages' syntactical hostility to immutable objects, especially immutable object construction. In OOP-family languages like C#, Java, etc it really is a significant burden to have to both define primary constructors and the logic for reconstituting an entirely new state-graph for actions that only make 1 small, tiny deeply-nested change.... across multiple deeply-nested objects. The next major burden is the extra workload involved to change all of the above when project-requirements change regularly. There are also associated problems with having to normalize the state-graph and how to handle back-references (as true immutable objects cannot have back-references to parent objects unless you add another layer of wrappers over the state graph, and now you see the problem...!).
Also, remember that statically-typed languages are not going to get anything like JavaScript's spread-operator for a long, long time.
It sounds horrible (if not being complete heresy), but having state exposed as read-only to components/consumers, while allowing state mutation in-place by actions, does result in a drastic simplification of logic (I can't really call them "reducers" at this point), while you do lose the "free" Undo/Redo bonus you gain much faster performance. The important thing is the strictly one-way flow of data within the application, which is preserved, as is determinism: replaying the same actions from the same initial state will still result in the same end result state. (I'm not strongly advocating for the above, I'm just saying that to non-Redux-experts like myself, compromises can and do have perceivable value; after-all, we aren't all working on the official Facebook mobile app).
MVVM is just hard to reason about and debug, especially with dodgy control implementations (more of an issue for UWP). It’s especially hard with converters and lack of great language tools. I also think the framework is in need of about 10 years of modernization that it just doesn’t get.
WPF (and MAUI and UWP and WinUI and UNO) would be so much better with:
- Razor for XAML: would obviate converters and a lot of other painful challenges
- Multiple styles for a single object; this is killer especially in a web context. It is really painful implementing web-oriented design systems in WPF. Tailwind for WPF would be amazing, but is more or less technologically impossible to implement due to framework limitations.
- Modern styles by default. WPF apps look bad out of the box. MS should make it easy to opt-in to a Windows 11 appearance, which this project proves is easily possible.
I sometimes wonder if it would be easier to skip the XAML altogether and build the object model in code.
What a completely flat-out wrong expectation about the state of LoB apps. But even worse: after they saw no-one was using Blend they killed it off and made Windows 10’s default WPF look so awful, as if to retroactively punish anyone for using WPF at all.
> who would seamlessly hand-off their visually-designed XAML to the implementation engs for data-binding and whatnot.
true, that was a wrong approach for LoB apps. But this is a fairly typical for workflow what happens with end user web apps nowadays. People use something like Figma + React instead of Bend + WPF.
Maybe MS assumed that WPF would be commonly used for end user software. Instead the web invaded the desktop in the form of electron.
The problem is the design, and that will change over time as the various flavours of Xaml are supposedly on a path to converge.
But where I beg to differ the WinForms bit. Fast as it may be, it's IMO way too conducive to people mixing UI / logic together and generally producing something that pleases the great Flying Spaghetti Monster, rather than any poor coder that has to maintain / bugfix said code.
In the end I guess it always boils down to "what's Your coding style and how well can You maintain discipline in it". WPF / MVVM, full of "gotchas" as it is, does at least one thing well : it gives newcomers a decent set of rules to begin with. Not particularly useful for a one-man project, but quite handy when there's a churn of developers in some bigger organization (my case).
It hasn't received major new features in a decade. It's currently owned by the Windows team (not the .NET team) and they have staffed it with a skeleton crew. They don't even have bandwidth to review most community PRs.
Even the .NET team doesn't get responses to issues they raise on the WPF repo: https://github.com/dotnet/wpf/issues/3811
Adding to all that, WPF has a massive dependency on C++/CLI which means it cannot take advantage of many new .NET features until that is rewritten. And from what I can tell (from the outside) that will never happen.
(but yes, true, WPF still works and it gets enough support to keep it limping along)
Editing IDL files without VS tooling just like in the good old COM days pre-.NET, lovely.
But anyway, my point is that it was hardly "abandoned at birth", given that WPF was originally released with .NET 3.0 in 2006, while the first version of VS to get WPF UI was VS 2010 - and more was rewritten since then. Even if no new VS components are ever going to be written in it, maintaining the existing ones makes it necessary to maintain WPF to some bare minimum standard.
(The same goes for WinForms and other UI stacks that VS still uses in places.)
We're mostly just re-hashing ideas from the 60s and the 70s anyway.
I think modern simply means "similar to what big tech does". So those ugly characters with big arms and small heads? Modern. Flat design? Modern. Is it good? Who cares, it's modern.
When it comes to GUI it looks like we are slowly converging back to Windows 3.1 in terms of visual and programming style. Is it modern?
But a lot of apps ignored them, wholly or partially, and just hard-coded colors. Try it with e.g. MS Word 6.
It means they think it can do modern web api stuff without having huge issues.
It also signals that the speaker thinks others would make a similar choice in the future, for a dev tool etc., hoping for network effect . community familiarity and support.
Well, to me that means things from the 1980s, when those ideas from 1960S and 1970s got sorted out and we got systems like St-80 with a small numbers of pervasive concepts, universally applied.
Then you got the postmodern period of Perl and friends...
It ports WinUI to iOS, Android, WebAssembly, macOS, and Linux.
"Uno platform 4":
https://news.ycombinator.com/item?id=29405909
Tbh, it looks like another "worse than freepascal / Delphi" solution... But maybe I've just given up on gui-stacks.
Personally I think web UI via WebView2 is the only way forward; Chromium is far and away the most powerful UI framework shipping with Windows these days. Even if "native" UI frameworks were doing everything right, it's hard to compete with all the investments in Chromium.
P.S. WinForms isn't dead; it's maintained by the .NET team and it gets a lot more attention than WPF. But, well, it's WinForms :)
Dead? Nonsense. WinForms is the most used technology/framework in 2021 for desktop GUI applications according to jetbrains.
https://www.jetbrains.com/lp/devecosystem-2021/csharp/
Also: https://blog.submain.com/death-winforms-greatly-exaggerated/
... but as someone who did a lot of Win32/UI App programming back in the late 1990s and early 2000s (up to and including early WinForms), I recently looked through the landscape of available UI toolkits and can confirm that as someone who hasn't been keeping up with this stuff for years its INCREDIBLY confusing as to what technology you should build new projects on looking through the graveyard of half abandoned aborted starts Microsoft seems to have made from back then until now, with almost everything being officially deprecated or early access/unfinished.
The fact that WinForms might still be the best solution for starting a new project on is more of a condemnation of Microsoft's combined efforts in this area than it is something to be celebrated, IMO.
So it's a Schrodinger joke?
https://developer.microsoft.com/en-gb/microsoft-store/overvi...
(although I couldn't find an actual tutorial on "I have an exe, how can I publish in store" - it should support legacy (non uwp) apps now).
I'm sure someone here will have actual experience doing this..?