Cross-Platform Desktop GUI Application using .Net Core

dotnet new --install GtkSharp.Template.CSharp
dotnet new gtkapp
Initial GUI Window
Initial GUI Window
pacman -S mingw-w64-x86_64-glade
Test GUI on Glade
Test GUI on Glade
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace GtkTestApp
{
class MainWindow : Window
{
[UI] private Label _label1 = null;
[UI] private Label _label2 = null;
[UI] private Button _button1 = null;
[UI] private Button _button2 = null;
private int _counter1, _counter2;public MainWindow() : this(new Builder("MainWindow.glade")) { }private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle)
{
builder.Autoconnect(this);
DeleteEvent += Window_DeleteEvent;
_button1.Clicked += Button1_Clicked;
_button2.Clicked += Button2_Clicked;
}
private void Window_DeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
}
private void Button1_Clicked(object sender, EventArgs a)
{
_counter1++;
_label1.Text = "This is incrementing: " + _counter1;
}
private void Button2_Clicked(object sender, EventArgs a)
{
_counter2--;
_label2.Text = "This is decrementing: " + _counter2;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Example Window</property>
<property name="default_width">480</property>
<property name="default_height">240</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="_label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="label" translatable="yes">Hello World!</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="xalign">0.5</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="_label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="label" translatable="yes">Hello World!</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="xalign">0.5</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="_button1">
<property name="label" translatable="yes">Click me!</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="_button2">
<property name="label" translatable="yes">Click me!</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
Publish Profile Settings Window
Publish Profile Settings Window
App at Windows 10
App at Windows 10
App at Linux Ubuntu
App at Linux Ubuntu
App at macOS Catalina
App at macOS Catalina

Windows Gtk Runtime

macOS Gtk Runtime

brew install gtk+3

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store