[Gtk-sharp-list] GTK# ComboBox Multicolumn

kmarecki marecki.krzysztof at gmail.com
Tue Jun 14 07:19:59 EDT 2011


Yes it is possible, in fact in GTK# you can achieve this much easier than in
If you have already added combobox to the parent container, e.g. using
MonoDevelop designer,
than this code snippet would do the work :

        Gtk.ListStore store = new ListStore(typeof(int), typeof(string));
        Gtk.CellRendererText ct = new Gtk.CellRendererText();
		ct.Width = (int)(combobox.Allocation.Width * 0.3);
        Gtk.CellRendererText ct2 = new Gtk.CellRendererText();
		ct2.Width = (int)(combobox.Allocation.Width * 0.7);
        combobox.PackStart(ct, false);
        combobox.AddAttribute(ct, "text", 0);
        combobox.AddAttribute(ct2, "text", 1);;
        combobox.Model = store;
        store.AppendValues(1, "First Text");
        store.AppendValues(2, "Second Text"); 

Kind regards 

View this message in context: http://mono.1490590.n4.nabble.com/GTK-ComboBox-Multicolumn-tp3596005p3596262.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list