[Gtk-sharp-list] Databindig IList to a Gtk.TreeView
Philip Van Hoof
spam at pvanhoof.be
Sun Apr 23 08:01:18 EDT 2006
On Fri, 2006-04-21 at 15:01 +0200, Philip Van Hoof wrote:
> Please take a look:
Also note that this Gtk.Mvc.ListAdaptor can (with some adaptations) can
probably also be used for the Gtk.ComboBox and other libgtk views that
use the C GtkTreeModelIface GTypeInterface struct.
This doesn't implement a full ComponentModel environment (like SWF has).
But it might open discussions and further experiments for getting true
databinding in GtkSharp working. I don't see how the SWF ComponentModel
doesn't use at least a little bit reflection for making the
column.MappingName = "Property" working on DataGridTextBoxColumn's
My implementation basically assumes the IList is a homogeneous list of
objects that implement that property some way or another. As I cache the
PropertyInfo instance, I'm not even sure it will work on a non
homogeneous list where the property is enforced by an interface. But not
caching the PropertyInfo would mean asking the reflection engine for
that PropertyInfo on for all items the view will show (this is slower).
ps. I basically need a pi.GetValue (instance, null) and a pi.SetValue
(instance, value, null) where it would be nice if that "pi" can be
cached. I'd need to search for the interface type to get the pi from,
I can't spend extremely huge amounts of time on it. Perhaps working on
all this is a fun task for a summer-of-code google student? It's just an
idea of course.
Philip Van Hoof, software developer at x-tend
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
work: vanhoof at x-tend dot be
http://www.pvanhoof.be - http://www.x-tend.be
More information about the Gtk-sharp-list