[Gtk-sharp-list] Databinding in Gtk#
m.j.hutchinson at gmail.com
Sat Dec 8 15:11:13 EST 2007
On Dec 8, 2007 1:12 AM, Miguel de Icaza <miguel at ximian.com> wrote:
> Hello folks,
> Matjaz is back on the channel, and I believe he wants to complete
> his work on databound Gtk# controls.
> It just occurred something to me: would it be feasible to use C# 3.0
> extension methods to extend the existing controls to be databound,
> instead of having to create a new hierarchy that derives from the
> original controls?
It's certainly possible, yes. There will be downsides for other
programming languages that don't have this syntactic sugar, including
C# on the 1.1 profile -- the code'll start to look like a GTK#/GTK+
> There are a few downsides to my proposal, for one, the storage of
> information associated with a control (in Matjaz' implementation, for
> example the ControlAdaptor and the changed state) would have to reside
> in the GLib.Object.Data hashtable and that might not be optimal at all.
For a start, GLib.Object.Data is deprecated. You'd probably have to do
some ugly hacks to associate data with the objects. Secondly, it would
be an awful lot harder to support the controls in Stetic. Thirdly, we
won't have Code Completion for extension methods until well after the
1.0 MonoDevelop release.
In the future it might be worth investigating, as you could do
interesting things like sharing databinding models across UI toolkits.
More information about the Gtk-sharp-list