Glade.XML Class
Allows dynamic loading of user interfaces from XML descriptions

See Also: XML Members


public class XML : GLib.Object


This object represents an `instantiation' of an XML interface description. When one of these objects is created, the XML file is read, and the interface is created.

The Glade.XML object can also be used to connect handlers to the named signals in the description. The easiest way to use this feature is to let it automatically connect signal handlers for you. This can be achieved by using the XML.Autoconnect() method.

XML.Autoconnect() searches the specified object or Type for method names matching those defined in the XML interface description file and connects them to the appropriate signals. It also searches for fields having the Glade.WidgetAttribute attached and tries to bind them to widgets of the same name defined in the XML description.

The following examples supposes that an XML interface description of a simple application exists in the file "". The application consists of a main window ("MyWindow") which contains a button and a text entry ("MyEntry"). The handler for the button clicked signal is named "OnMyButtonClicked" and the handler for the window delete event is named "OnMyWindowDeleteEvent".

C# Example

using System;
using Gtk;
using Glade;

public class GladeApp
        // declare the widgets you will use from glade	
        Gtk.Entry MyEntry;
        public static void Main (string[] args)
                new GladeApp (args);

        public GladeApp (string[] args) 

                Glade.XML gxml = new Glade.XML ("", "MyWindow", null);
                gxml.Autoconnect (this);

        // Connect the Signals defined in Glade 
        public void OnMyWindowDeleteEvent (object o, DeleteEventArgs args) 
                Application.Quit ();
                args.RetVal = true;
        public void OnMyButtonClicked(object o, EventArgs args)
        	Console.WriteLine("In entry: " + MyEntry.Text);


Namespace: Glade
Assembly: glade-sharp (in glade-sharp.dll)
Assembly Versions: