DEV Community

loading...

How do I create a cross-platform window in C#?

baenencalin profile image Calin Baenen ・1 min read

I've recently came to C# to Java to see if I could get any success creating an application in this way, by creating a few window tests.

I want to do this in pure code (like I did in Java), and want a library similar to Java's java.awt.*+javax.swing.*.
And, I found something that looks suitable, System.Windows.Form, but, as far as I've read, and as the name (kinda) implies, it's windows exclusive.

Is there any cross-platform library that accomplishes the same things, with a similar formatting (to that or the one in Java)?

Thanks!
Cheers!

Discussion (6)

pic
Editor guide
Collapse
redcreator37 profile image
RedCreator37

What's the reason behind creating cross-platform GUI apps in C#? I get if it's for learning purposes, but if you'd just like to quickly bolt together something that works, sticking to Java's Swing/JavaFX is not a bad choice. Cross-platform GUIs can be quite a mess (even with QT and such) and while MS is heavily working on developing C# x-platform GUIs, they're still tricky to use.

PS: If you're interested in Windows GUI development, also take a look at WPF. It's sort of a more modern WinForms alternative, but works a little bit differently.

Collapse
baenencalin profile image
Collapse
peskic93 profile image
peskic93

I'm not 100% sure, but as I've read you can use blazor to create cross platform apps. I think it's similar to javascript electron.

dotnet.microsoft.com/apps/aspnet/w...

Collapse
redcreator37 profile image
RedCreator37

There's also .NET Multi-platform App UI, which is still in early development.

Collapse
baenencalin profile image
Calin Baenen Author

What's Javascript Electron (for context)?

Collapse
peskic93 profile image
peskic93

I checked after i commented here, it's js framework to run applications like desktop apps using chromium browser. It's really good but a bit "heavy" for older computers.

You can build blazor application and wrap it using electron. But again you would have to configure ui and all features using electron build configuration.

For more info read their documentation here: electronjs.org/