[Gtk-sharp-list] Databinding in combobox

David S buttink at gmail.com
Thu Jul 29 15:06:55 EDT 2010


ComboBox works exactly like TreeViews

Here is a code snippet from a custom ComboBox I made.

// this class is inherited from ComboBox BUT this can be done EXACTLY the
same way without it.
// The only difference is the ComboBox variable would be before all the
calls
store = new ListStore( typeof(string), typeof(string), typeof(bool) );
RowSeparatorFunc += (TreeModel model, TreeIter iter ) => {
return (bool)model.GetValue(iter,2);
};
CellRendererPixbuf pic = new CellRendererPixbuf();
PackStart( pic, false );
AddAttribute( pic, "stock-id", 0 );
CellRendererText text = new CellRendererText();
PackStart( text, false );
AddAttribute( text, "text", 1 );
Sensitive = true;
Model = store;

If you want to know more about TreeViews go
here<http://www.mono-project.com/GtkSharp_TreeView_Tutorial>
.

On Thu, Jul 29, 2010 at 2:51 PM, Claudio Rocha de Jesus <
crochadejesus at gmail.com> wrote:

> Hello everyone,
> recently started programming using GTK #, and my question is how do I make
> a data connection in gtk.combobox?
>
> Thanks
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100729/761d2811/attachment.html 


More information about the Gtk-sharp-list mailing list