Since we have the .NET Core framework installed on the RPI.
Are we now able to build .NET GUI apps ?
The answer is not really as out of the box ?
But if you have MONO installed in your RPI it is possible.
Nothing to recompile even, see last example of this post
There have been a few other attemps made as well.
Cross Platform WinForms, using ETO.Forms Library see here
You need to install the .NET NUGET Packages from here
dotnet add package Eto.Forms --version 2.5.11 dotnet add package Eto.Platform.Gtk --version 2.5.11
Once installed follow the code Examples here :
dotnet new -i "Eto.Forms.Templates::*"
Next create a new ETO WinForms App
dotnet new etoapp -sln -m code -s
IMPORTANT : to have the .NET Core version 3.1 installed in your machine !
When you create a new ETO WinForms project make sure to reference to correct ETO Package Version
<ItemGroup> <PackageReference Include="Eto.Platform.Gtk" Version="2.4.1" /> </ItemGroup>
You can check the installed packages here
Build and Run the Windows version first to test if all is OK.
dotnet build "\WinformsTESTLinux.WinForms.csproj"
Now build the Linux Gtk version :
These are the project settings for a Gtk Form on Linux
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\WinformsTESTLinux\WinformsTESTLinux.csproj" /> </ItemGroup> <ItemGroup> <PackageReference Include="Eto.Platform.Gtk" Version="2.5.11" /> </ItemGroup> </Project>
Build the Gtk Form as follows (Don’t forget the specify the correct Runtime!!):
dotnet build "\WinformsTESTLinux.Gtk.csproj" -r linux-arm
Copy the binaries to your RPI and run it
We have built our first cross-platform Linux GUI using the ETO.forms
Another option is that you create a WRAPPER around the ZENITY GTK tool
Either using a .NET Core Console App or using PowerShell
I have created a PowerShell module to make life easier …
RASPBIAN GUI Design
Anyhow if you are not into .NET Core cross-platform GUI development.
Here are a few tools that get you started Developing GUI apps on your RPI
ZENITY : see here for how to :
Zenity is available out of the box in Raspian.
If you are looking for an GUI IDE use this one.
it is simple and easy to use and it just does work all the way
See here on how to interact with Zenity Widgets / Controls
See here for an SQLite DB in Zenity Example
sudo apt install glade
Mono on RPI to run cross-platform .Net Gui’s
See here for how to.
Mono is not installed use this command
sudo apt-get install mono or VB.net sudo apt-get install mono-vbnc
Create your WinForms App compile it and run it on your RPI, no re-compiling required!
This is a 1 to 1 compiled simple WinForms application on mono
Compile using the ANY CPU settings
Run it on you RPI
Also the button click event work