Modernizing .NETpad Step-By-Step, Part 7: Clean-Up in Aisle WPF (Premium)

In this final phase of this year's .NETpad modernization project, we'll clean up the code a bit and make a few minor UI changes.
Why
Even I sometimes forget what the point of this app was originally. But if you go back to the OG version of the app, the OG Windows Forms version, which I had created to teach myself Visual Basic .NET and that app framework, I had had an idea. A theory that one could create most of a complete WinForms app without writing a single line of code. And that the code could be minimal, like connective tissue. It would bind the UI bits together and respond to events, and in doing so, make this nearly finished thing a completely finished thing.

As it turns out, I was wrong: Yes, it's incredible how much of an app you could build using just Windows Forms and its VB-inspired visual development tools. But you still needed to write code. And as I moved forward through different versions of the app using different frameworks, the coding requirements changed and expanded dramatically. Starting with WPF, even the user interface was built using code, though this time it was XML-based XAML code, not C# code. Code that is quite verbose. And that style of development has continued to this day; all subsequent Microsoft app frameworks have used the same basic model.

Because of this, my goals shifted. Starting with the OG WPF version of the app. I knew there would be a lot of coding, but I was curious about duplicating as much of the real Notepad as possible. The WinForms version looked like Notepad, but it was a bit bare-boned. How much more could I do from a functional perspective? What I found out was, quite a bit. But not always perfectly. Some of this was my own limitations. But Microsoft's support of WPF has always been spotty, and even in the early days, I had to roll my own Font dialog and Input box because this environment didn't natively support those Windows features for reasons I'll never understand.

By the time 2024 rolled around, Microsoft had shipped Windows 11 with yet another an all-new user interface theme and improved support for system-wide light and dark modes. It had shifted from UWP to the Windows App SDK for new apps, and it had shifted from Xamarin Forms to .NET MAUI for cross-platform mobile apps. And then, at Build 2024 in May, it announced the unexpected: WPF was back from the dead, sort of. Microsoft would officially support modernizing existing WPF apps with Windows 11 theming support. This project was born.

I want to make .NETpad look and work as much as possible like Notepad in Windows 11. But the goal for this specific version is a bit different than before. Like real developers, I have this legacy app that I'd like to modernize so that it looks and runs as well as possible in Windows 11. There are other possibilities for the future, including ground-up new versions of .NETpad in WPF and the Windows App SDK, both of which I've looked at (and done, to some degree). But this version, this...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Thurrott