Software framework
GTK# is a set of .NET language bindings for GTK, the cross-platform graphical user-interface toolkit, allowing C# and other .NET languages to create native-style desktop applications. It connects managed code with GTK's GObject-based libraries and is commonly used with GLib, Cairo, and related GNOME technologies.
GTK# provides managed wrappers around GTK and its supporting libraries rather than replacing the GTK toolkit itself. GTK supplies widgets, event handling, layout, accessibility hooks, and rendering integration; GTK# exposes those facilities to C# through .NET types and methods.1 The bindings also cover important parts of the GLib and GObject stack, including object ownership, signals, properties, and reference-counted native objects.5
Applications therefore combine two worlds: the .NET runtime manages C# objects and garbage collection, while native GTK libraries retain their own lifecycle rules. Binding layers translate calls, callbacks, enumerations, and errors between them. This arrangement gives developers access to GTK's broad platform support, but it also makes version compatibility and disposal semantics significant engineering concerns.
GTK# developed alongside the Mono project as the GTK family expanded from GTK 2 to GTK 3. The original Mono-hosted project supplied C# bindings for GTK+, GNOME libraries, and related components, and helped make Linux desktop programming approachable to developers familiar with Microsoft .NET.2 GTK itself later adopted the shorter name GTK and introduced substantial API changes between major versions.1
Modern GtkSharp is maintained as a separate .NET binding project with packages and source organized around particular GTK generations.3 Consequently, “GTK#” can refer either to the historical Mono bindings or to newer GtkSharp releases. Code written for GTK# 2 or GTK# 3 is not automatically source-compatible with GTK 4, whose APIs and application patterns differ.
GTK# programs construct windows and widgets, connect signal handlers, and enter GTK's main event loop. A typical application creates a Gtk.Application, builds an interface from code or a UI description, and responds to events such as activation, clicks, and text changes. GTK's widget hierarchy and layout model encourage event-driven composition rather than platform-specific window procedures.1
Deployment requires both the managed assemblies and compatible native GTK libraries. NuGet packages can supply the .NET-facing portion, but operating-system integration may still require GTK runtimes, platform backends, fonts, and theme resources. Native interoperation also means that callbacks and unmanaged resources must remain valid for the required lifetime; explicit disposal and careful threading are often preferable to relying only on garbage collection.
GTK# is not limited to visual widgets: its ecosystem exposes GLib data types, GObject properties and signals, Cairo-based drawing, and—in some releases—GNOME-oriented libraries. These layers are useful for custom controls, model-view interfaces, asynchronous operations, and integration with desktop services, but their availability depends on the binding generation and package set.
A less obvious distinction is that GTK's licensing and .NET's licensing are separate questions. GTK is distributed under the GNU Lesser General Public License, while an application's own license and the licenses of its binding and packaging components must be checked independently.1 Another edge case is toolkit mixing: embedding GTK# alongside another GUI framework can create competing event loops, native-window ownership problems, and inconsistent platform styling. For new work, selecting the GTK major version first is usually more consequential than selecting the C# project template.
GTK# naming covers several generations of bindings; consult the documentation and package metadata for the specific GTK major version used by a project.
Help improve the encyclopedia. Reports go straight to the site manager.