How can I use CSS styling in my GTK# application?


Tags: css,mono,gtk,gtk#,banshee

Problem :

How can I use CSS styling in my GTK# application? I heard before that it is impossible to use CSS themes in GTK#, but after that I found this example of using css styling in GTK#. Besides this I found also the samples of using CSS styling in Banshee project (which uses GTK#). So how is it possible? I already tried to do the same in GTK#, but I didn't find CssProvider class. So how I can find this class in GTK# or how I can using CSS styling in GTK#?



Solution :

CSS Styling is a GTK3 feature.

GTK# for GTK3 is not released as stable yet.

Xamarin (the main force behind mono) have publicly announced that their product (Xamarin Studio/Mono Develop) will not be moving to GTK3. This means that GTK3 support must come from the community and as a result has been very slow in coming.

It is likely that you cannot find the CssProvider class because you are using the GTK2 bindings not the GTK3 bindings.

If you would like to try the beta GTK3 csharp bindings then you can find them here: https://github.com/mono/gtk-sharp/releases

Because Xamarin Studio will not work with GTK3 I would recommend either:

  • Compiling GTK# yourself such that Xamarin Studio can continue to run on the installed GTK2 bindings.
  • Use Visual Studio which has no dependency on GTK#

    CSS Howto..

    How do i set 100% in a div tag background?

    How to only underline text element inside an element in CSS?

    How to exclude inner webelement with css selectors?

    How to find the relevant stylesheet for a specific CSS code [closed]

    Markup/Style best practices: How to efficiently distribute style rules over CSS classes?

    How to remove odd bottom padding from gradient inside a button on firefox?

    How to change parent element css-properties by clicking on his child without javascript

    CSS: How to add icon/image after input element

    How to elasticity of the char length in javascript or css? [duplicate]

    How are these websites full-screened in the browser with a learn more button at the bottom (moves you into automatically down the page) [closed]

    Getting an error message to show up inline of input

    How to decode base64-encoded font information?

    Once I've designed a navigation bar using CSS & html — how can I put the html code in one place so it shows in each window? [duplicate]

    How can I apply a css transition to an element when its parent is hovered?

    How should I create a web interface for my application? [closed]

    How can I add image to facebook login button?

    How to override background of Bootstrap Material Design theme?

    How set css style to GWT TextBox text?

    How to set ID or css selector for new row added in table using javascript

    How to create a image frame by css?

    How to disable auto genrated css in media folder at runtime Magento?

    Show hint over a CSS background image on mouse over

    how to set zoom level using css

    How to override the default css class using c#

    How can I place two grid items above each other using Susy?

    CSS : How can I add shadow to a label or box

    How to turn on Visual Studio 2008 .css Intellisense on .less file

    Show/Hide function between JS, CSS, and HTML

    How to Change HTML Tags Using Javascript

    How does the CSS Block Formatting Context work?