I am in the process of converting an existing C/GTK+ GUI application to C# using GTKSharp in Visual Studio 2017. To facilitate this, I have installed the following package https://www.nuget.org/packages/GtkSharp/3.1.3 via NuGet.
Below is how I am loading the CSS (the application utilizes a Glade file to define the interface):
static void Main(string[] args)
{
new Program(args);
}
public Program(string[] args)
{
Application.Init();
builder = new Builder();
Gtk.CssProvider provider = new CssProvider();
builder.AddFromFile("interface.glade");
provider.LoadFromPath("style.css");
builder.Autoconnect(this);
Gtk.Window window = (Gtk.Window)builder.GetObject("start");
Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, provider, 800); // couldn't find the equivalent to GTK_STYLE_PROVIDER_PRIORITY_USER so I set the priority to a random number
window.Show();
Application.Run();
}
The naming conventions for selectors appear to vary between GTK+ and C#. For instance,
window {
...
}
is effective in C/GTK+ but not in C#, whereas
GtkWindow {
...
}
works in C# but not in C/GTK+. Furthermore, there are certain widgets that I am unable to style at all. For example,
button {
...
}
can be styled in GTK+, however,
GtkButton {
...
}
does not yield the desired results in C#. My attempt to find documentation on how GTK# handles CSS styling has been unsuccessful, as I initially assumed it would mirror GTK+. Any advice or guidance on this matter?