[Gtk-sharp-list] DataGrid control, data binding, ObjectViews, Swf, Gtk

Gennadiy Donchyts don at env.com.ua
Sat Nov 19 17:42:46 EST 2005

On 11/19/05, Daniel Morgan <monodanmorg at yahoo.com> wrote:
> I really do wish someone would create a real-world enterprise-class DataGrid
> for gtk# with Data Binding and many other fancy features.
> And take this DataGrid and make it part of Gtk#.   Maybe have another gtk#
> assembly for these extra widgets.

Yes, I was thinking also that it would be nice to have some separate independent
library from MD, sqlsharpgtk, etc. that will include all higher level widgets
(something like graphical user interface building blocks
library,should think about
right name later), probably later someone will include it in Gtk# if it will be
interesting or to have it as an addition to Gtk#.

> Anyways, I have something I have worked on for awhile, maybe others can
> improve upon it and give back.  If someone is interested, we could put it
> into subversion somewhere with other gtk# widgets.  Chris and I have
> discussed this in the past, but there is only so much time.

Thanks for the sources, so I will use them to start and then will
contribute back when something will improve. I plan to spend a bit of
time working
on that DataGrid improvements, especially data binding. I'm trying to
data bind it to
a collection of objects right now but it also should work with the ADO.NET

Please put some other widgets or send it by mail.

> Here are the source files I included:
> DataGrid.cs - creates a DataGrid for Gtk# with data binding support.
> TestDataGrid.cs - tests the gtk# data grid
> Basically, you can take a pre-loaded DataTable, and then "data bind" it to
> the DataGrid.  It may not be true data binding like SWF or webforms, but its
> an attempt.
> A change to the data in the DataGrid w! ill update the data in the
> DataTable.
> If you add a row or delete a row in the DataGrid, it will be reflected in
> the DataTable.  If you modify a cell in the DataGrid, the row and column in
> the DataTable will be updated.

With the data table it should not be much problems but with object
collections it could be a bit different, however if all information
could be filled
from the grid - it should be possible to implement it using
ObjectViews. I will try
to look at it later.

> In the test, there are four menu items:
> 1. Add Row - adds a row
> 2. Dump Table - dumps to the console what's in the DataTable
> 3. Editable - sets the DataGrid editable or not
> 4. Delete Selected Row - deletes the highlighted row
> One thing I would love to see added is an Input Mask and Format properties
> added to each column.   Let's say you would like to format dates as a short
> date, you would put "Short Date" in the format property for any locale.  Or
> you could set it to "MM/DD/YYYY" for US locale..   A numeric column you
> could have it format as "###,###,###.##" or just simply say "Currency" for
> any locale.
> An input mask could limit certain characters, such as, alpha only, nu! meric
> only, alphanumeric.  Canadian postal code i believe is alpha, numeric,
> alpha, space, numeric, alpha, numeric.  So your input mask would be: "ANA
> NAN".

It could be done with something like standard formatters, have not a lot of
experience with it but should be no problems to add it for columns metainfo
classes and to render in a proper way in grid.


> Anyways, please let me know if this is what you wanted.
> Christian Hergert <christian.hergert at gmail.com> wrote:
> The original version of the datagrid i put in monodevelop was taken
> from sqlsharpgtk. Daniel has since done some additions to the
> monodevelop version to support basic editing and deletion. It also had
> support for somewhat of a managed tree model. To be honest, im not
> sure if ive merged that support yet. Both versions are a hack
> regardless.
> Your example below will not work. First, you cant add an object to a
> gtk container that doesnt inherit from Gtk.Widget. Secondly, even if
> it did work, you would have just doubled your requirements on every
> platform to both gtk and swf.
> -- Christian

More information about the Gtk-sharp-list mailing list