[Mono-list] Integration ADO.NET with GTK#

Daniel Morgan danmorg@sc.rr.com
Mon, 20 Jan 2003 18:01:41 -0500

Hi Jorge,

You can take a look at the DataGrid.cs in SQL# For GTK#
which is currently located in mcs source at

Down the road, SQL# For GTK# will be moved to its own cvs module

The DataGrid in SQL# is just an idea for how to provide data binding
between a System.Data.DataTable and a Gtk.TreeView using a ListStore tree
A Gtk.TreeView using a ListStore tree model is much like a ListView or grid
or columned list.
However, what is in DataGrid.cs only works for a TreeView using a ListStore
model.  It could be designed to allow multiple data sources, such as,
ArrayLists, arrays, IList, IEnumerable, ICollection, and IDataRecord.

Some of the data binding functionality could be moved to a base class so
other GTK Widgets can take advantage of data binding.  Or each widget
implement an interface.  Or maybe, each widget can be data bound have
customization data binding.  This would require the permission of Mike

Data binding functionality could be used in other classes, such as, a
TreeView using a TreeStore model being loaded from an XmlDocument, a
Notebook for automatically creating tabs from an ArrayList, or automatically
populating a Gtk.Combo.  Also, some data binding could be done for simpler
widgets, such as, set text in a TextView, set text in Gtk.Entry, or toggle a

For a great example demonstrating data binding, take a look at this example:

http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=data bind

By the way, don't forget the "data bind" at the end of the URL there.
its a search at http://www.gotdotnet.com/ for "data bind" for user samples.
Other sites to search for examples include http://planet-source-code.com/
and http://www.asp.net/

If you look in Mono's ASP.NET (System.Web), the developers of Mono's
System.Web have done a great job of implementing data binding for web

If you have a windows machine with the .net framework on it, you could
experiment with the System.Windows.Forms.DataGrid by data binding it to a
DataTable or DataSet.

Or experiment by populating a ListBox from a string array.  This example
sure is a lot easier to do than manually adding each item to ListBox via

   string[] strValues = new string[] { "one", "two", "three" };

   // using Items.Add(xxx)

   // using DataSource
   listBox2.DataSource = strValues;

As far as I know, setting a DataSource to a simple data source, such as, a
string array only uses it to populate the data.  However, for complex data
sources, such as, a DataSet being set to a DataGrid's DataSource property,
it is dynamaic.  For instance, if a user updates a cell (a specific row and
column) in a DataGrid, the updated value in the DataGrid will automatically
update the value in the DataSet.

You could also experiment with System.Web.UI.WebControls.DataGrid and do the
same data binding to a DataTable or DataSet.

Oh, a neat customization for a TreeView using a TreeStore model would be
that only portions of it would be populated based on what branches the user
has clicked on to see more.  The Data Source could be an XmlDataDocument
which was loaded from an XML source or from a DataSet via a Database.

Anyways, these are just ideas...


-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of Jorge Pérez Burgos (Koke)
Sent: Sunday, January 19, 2003 6:49 PM
To: mono-list@ximian.com
Subject: [Mono-list] Integration ADO.NET with GTK#


	I'm very interesting with the integration of ADO.NET with GTK#. I want
to begin to implement the data binding to a GtkTreeView if none is doing
it. Can you explain the best way to do this?


Mono-list maillist  -  Mono-list@ximian.com