[Gtk-sharp-list] TreeModel for ILists

Christian Hoff christian_hoff at gmx.net
Mon Aug 10 03:33:33 EDT 2009

Hi folks,

as you probably have noticed, there already was a discussion about IList 
support. I have written a custom TreeModel for my application which is 
able to bind any IList (including DataView) and thought about adding it 
to Gtk#.

In my opinion it would be a nice addition as there are lots of people 
wanting to display a DataView in a widget - Matjaẑ (developer of Gtk# 
Databindings) says there are lots of people asking him whether the next 
version of his project was able to bind them :-) .

But I still think we should include IList support in Gtk# directly as 
there are many users who may only want to show a DataView, but do not 
want to depend on a full databinding project that is not packaged by 
many Linux distributions.

The flaw with the current TreeModel-based approach is simply that it 
provides no capabilities of editing the IList and that it is not really 
You just have a TreeModel which is read-only, have to take care of 
adding the appropriate number of columns to your TreeView/ComboBox, 
filling these columns with a CellRenderer, connect to their "edited" 
events to make sure the changes are reflected in the Model/the IList. Uggh.

The second problem is there are existing databinding projects around. It 
will confuse a user of Gtk# DataBindings to see that TreeView has a 
"List" and a "DataSource" property. This is a collision that we would 
like to avoid. Maybe the best solution would be to have only one 
("DataSet"?) property. When being set, it checks for TreeModels being 
able to bind this type of data. We could use some kind of pluggable 
mechanism to allow registration of other custom TreeModels.

Matjaẑ is currently working on a minimal, generic code base for data 
binding support in Gtk# using extension methods. I'm excited about the 
results. Maybe the best choice would just be to wait until it is ready 
and see if we can possibly add it together with the IList stuff.

I would also be great for some feedback from the community, inparticular 
whether you would appreciate support for ILists in Gtk#, how your 
project displays DataViews, etc. Feel free to chime in :-) .


More information about the Gtk-sharp-list mailing list