27-12-2007

GenericGrid

Por esas cosas de la vida, me puse a implementar una grilla en Gtk (TreeView), en gtk-sharp. Hace tiempo que no lo hacia y al ver la API, inmediatamente me dio paja. :P

Me acorde que hace tiempo (2años?) hice un shortcut para hacer grillas y lo encontre! y esta weno! y es facil se usar!

Es tan bonito como escribir lo siquiente:

Grid g = new Grid();

g.ObjectChanged += ObjectHasChanged;

g.ObjectCreated += ObjectIsNew;

g.ObjectDeleted += ObjectRemoved;


List lista = CreateTestObj();

g.Manage(lista);


:)

TestObj, es el tipo de objeto que la grilla muestra, y esta decorado con atributos que le indican como dibujarse, por ejemplo:

[Column("Percent", Type = typeof(PercentInt), Resizable=true)]

public int Percent

{

get { return percent; }

set { percent = value; }


}


Esta super util. Si alguien le interesa que avise...