Yet another "Quick And Dirty" Cross Platform Desktop Framework, for macOS and Windows.
Drastic UI is a cross-platform UI framework for macOS and Windows, intended for quickly hacking together UI. Unlike other frameworks that aim for beautiful UIs with an artistic vision that looks great on the app store, Drastic.UI is for the "I just need a button and a click handler" crowd.
A direct port of the macOS and WPF Forms platforms, Drastic UI has all of its features. I've only changed the namespace (to not conflict with Xamarin Forms) and updated the implementations to work on .NET6+. All included controls should work as they do in Xamarin Forms 5, but honestly, I only cared about the grid and buttons. YMMV.
I do not intend Drastic UI as a "Production" framework. It's a hack that lets me quickly make a UI with an API I already know, which could be helpful for others in the same situation.
Setting up the project is similar to setting up Xamarin.Forms on macOS or WPF.
- Setup your macOS (
dotnet new macos
) or WPF (dotnet new wpf
) app. - Reference the Nuget or Source Projects into that project. You can also reference it in a
netstandard2.0
project if you want to share the UI between them. - If you want to use the full "Application" layer and treat it like a Xamarin.Forms app, reference the XF docs above and set up the
FormsApplication
scaffolding for the projects. You can reference thesamples
directory as well to see how to do it. The biggest differences are changingXamarin.Forms
toDrastic.UI
andForms.Init()
toUI.Init()
. This features the same limitations as Xamarin.Forms, as it's functionally the same thing. - You can also use the "Native Embedding" feature to inject the Drastic.UI layouts into an existing layout. Again, this is the same as Xamarin.Forms. The docs for that apply to Drastic.UI as well.
- Of the two, I prefer using the Native Embedding model as it's the most flexable. But removing
Application
would take far more effort than its worth just for this project, and it still could be useful if you wanted to port an existing Xamarin.Forms app over.
- XAML support is not included. It could work but figuring out how to get the build tasks working and bundled into the library was far too time consuming. For the work I wanted this for, I didn't need it anyway. However, it could be done.
Xamarin.Forms.XAML
itself isnetstandard2.0
, and while the build tasks from Forms use msbuild and .NET Framework specific commands, backporting changes from MAUI should make that work too. If anyone wants to do it, I wouldn't be against merging that in. - Xamarin.Essentials does not work on
net6+
platforms and I didn't port it here. There's not much reason to, as you can use theMaui.Essentials
library instead. Include that by referencingUseMauiEssentials
in your csproj. You don't need Xamarin / MAUI essentials to run Drastic.UI. - The other Xamarin.Forms platforms (iOS, Android, etc.) are not included. Those were out of scope for what I wanted to do here (quickly hack on UI for desktops). You can port the Xamarin.Forms stack to .NET 6 though if you really want to go down that road. At this point, however, I would move to MAUI or Avalonia if you really want a cross platform UI framework.
- I've included Xamarin.Forms C# Markup directly into
Drastic.UI.Core
. It should be functionally the same as that, but with the namespaces changed.