Creating desktop applications across multiple platforms has always been an elusive thing. In .NET, there are a few options but none without drawbacks, most notibly is that the application will not look or behave like a native application for that platform, or that there are extra dependencies you must install/package with your app. Using the very excellent mono framework, one can certainly write C# and .NET code that run across all platforms, including Mac OS X, most flavours of Linux, and Windows. This does not mean, however, that your UI code will work across all platforms – that is a different beast.
A few of the existing options for cross platform UI development (that I’ve seen people use) in .NET are GTK# and Windows Forms.
I’ve seen it time and time again; someone trying to wrangle an existing Windows Forms application to work on OS X. It looks horrible and functions even worse, which is not surprising as mono’s implementation of Windows Forms is largely unmaintained and does all of its own control rendering.
GTK# does a decent job and is fairly well supported on all platforms, however it too does not look native on OS X and cannot easily be packaged with your app on Windows or OS X.
Another alternative to using a cross platform toolkit is to write multiple versions of your UI, and share only the back end logic of your code. This is one of the better ways of getting a real native experience on each platform, but requires a lot of work if your UI is complex or has a lot of UI-specific logic. Ideally, if your interface will be similar across platforms, you should be able to share the code.
Here is a (simple) comparison of UI Frameworks for .NET:
|Framework||Platform Support||Extra dependencies*||Native on all Platforms?|
|GTK#||All||GTK# installer for Windows, Mono framework for OS X||No|
Linux/OSX: poor support
|Mono on non-Windows platforms||No|
|Qyoto (QT)||All, little usage||QT on non-Linux platforms||No|
|wxWidgets||All||wxWidgets on all platforms||Yes|
|MonoMac||OS X Only||None||N/A|
*Extra dependencies that are typically not already on each platform
Eto.Forms, which is a new BSD licensed (commercial app friendly) open-source UI framework, provides a new way to build desktop applications in .NET. You can write simple, clean code and then have that code run natively, with no extra dependencies that wouldn’t already be available on each platform. Instead of choosing a framework above, you can target them all! (or, well a good portion of them.) The platforms that Eto.Forms supports currently are:
- Windows using Windows Forms or WPF
- OS X using MonoMac (creates an .app bundle with no additional dependencies)
- Linux using GTK# (which come pre-installed or easily installed on popular distros such as Ubuntu and OpenSUSE)
Use Native Power! Without the headache.
A typical drawback of using a cross platform framework is that you can’t necessarily take advantage of each platform’s capabilities. Since Eto.Forms is just an abstraction layer, all of the power of each platform can still be fully utilized if need be, by way of its built-in styles mechanism, by creating your own abstracted controls, or by wrapping your Eto.Forms shared code inside of an existing native app.
What does it all mean?
Of course, no framework is the be-all end-all of frameworks. Eto.Forms is relatively new, thus there will be use cases that it does not support yet. Being open source you have the advantage that you can add any functionality as required, though a full compliment of typical controls are already fully functional on all platforms. This means you can create apps that look and work great on all platforms, with one set of code.