Introduction into System.Data.Bindings and Gtk.DataBindings
People keep asking me questions which always start with the same thing... "In WPF...".
Well, ... if you're looking for WPF then you should either simply skip to "System.Data.Bindings.DataBinder"
which provides same functionallity except Validators and Converters
(... please, read at the bottom) then you are missing really big point
on what data binding really is.
Like first, people tend to confuse System.Data.Bindings with what
they've seen so far. Gtk.DataBindings is probably the first place they
rush to. Wrong... Gtk.DataBindings is completely different approach
than WPF. It doesn't just map property to property and leaves you in
blind in the water. Gtk.DataBindings is completely managed approach where one
can map his GUI layout. At the same time it tries to hide from
developer to not impose any strain on him. Managed widgets and property
to property is something completely different. You can do for exmaple
and this will bind those two together. Well, in a sucky ordinary way... yes.
But... now you ask your self... how many times did you need to bind
something else than Text in entry? I haven't. And I don't even want to
know property I'm binding to. But I want my entry knows when editing is
valid and when it is not. I don't even want to know if thread I'm
working in is right one or not. After all, it is called managed.
Having manged data binding is something completely different than property to property.
Connections can be swapped on the fly, widget will control its own
sensitivity and editability. If you use DataAutoLayout? It will even
swap widget to get registered widget based on widget factory theme for
new type or property. DataLayoutBox? Provides handling of the same
mappings as ColumnMappings in TreeView and it will create presentable
layout for editing or displaying data based on widget factory theme.
Gtk.DataBindings are not data bindings, but rather managed System.Data.Bindings plugin user.
System.Data.Bindings can connect and map in following ways:
- object-to-object
- property-to-property
- property-to-widget
- widget-to-widget (done in my test release)
- list-to-list
Completely removes the need to play safe with threads
Completely pluggable
It supports following type of data sources:
- direct reference
- adaptor (pointer) based
- mapped datasources
- custom resolved
It can connect to:
- objects
- static objects
- structs
- anonymous objects
- enums
- arrays
Valid types for property are:
- property
- virtual property in virtual objects
- DataRow columns
- methods (yes, extension methods or methods can be used as property mapping)
Provides extensive amount of wrapping classes:
- You used list and want to make it observable? wrap it
- You used IBindingList and want to make it observable? wrap it
- Want to make observable list act like IBindingList? wrap it
- Want to make DataTable/DataView accessible as ordinary list? wrap it
- Want to have on the fly sorted/filtered lists? wrap it
- Want to create virtual copy of some class and add property? wrap it
and so on
Allows you to:
- describe properties for auto layouting
- describe classes with views and
- provides factory cell/widget registrations
- widget theme registrations
and so on
System.Data.Bindings is platform/toolkit independant, Gtk.DataBinding
About Converters and Validators
(Sorry, for some personalized expresions, but I don't have warm
feelings about this topic as it already used way more time than it
shuold so far. People simply rather use million lines of text to
persuade you, than sending one clean and simple example with commented
explanation, or they keep asking and asking because they want to do it
them selves, which always leads to zero result)
After all my asking to get one single example from people who wished
for it and a bit of explanation what they want with Converters and
Validators, I never got one sample which would show me why this feature
would be worth my time (it even goes exactly against my principles)...
but still... since I want to provide most extensive data binding
solution ever, you can send me clean examples of their use and I will
make plugin extension which will employ that functionality. Do not even
bother to talk to me how you would like to implement this (at least 20
people volunteered for that and no one did anything). Do it. If patch
is clean and separated I will incorporate it into my bindings.
Few possible approaches to do it your self: - Go to
System.Data.Bindings/simpledatabinding and hack support in there. As
this is very nicely separated data binding (and probably new engine too
if I succeed to port all other features inside (few minutes job, if you
know what you are doing). This is already doing what data binding
engines do. Features missing in this engine which exist in old one are
relieving and caching of events, circular event prevention... (Easy
job) Bigger problem is that property-to-property is not even nearly
sufficient for real data binding. Getting support to maintain real
managed data binding on the other hand is harder. Those missing
features aren't present anywhere either, so my best guess is people
don't even know what they miss.
- Create System.Data.Bindings.Wpf assembly, and make it standalone. I'm
prepared to make it compatible with everything else so it can be used
with complete engine and to be integrated with ordinary gtk widgets
(EASY, considering how plain it is, it is a one day hack) -
Hack'n'slash it into this solution (HARD), if patch is clean I will
accept it. But I would rather see patch made on first solution as this
engine might be subject of complete change
I simply don't have time to study extensive documentation, send me
clean and commented examples of their use in Ms.Net and I will hack
them in one day. It shouldn't take more. Don't send me WinForms
application for example. It is a clusterfuck to read. I got at least 20
of those so far... (worst of all, I even got complete WinForms
application with 52000 lines of code). I DON'T HAVE WINDOWS OR VISUAL
STUDIO and people still keep sending me same shit all over again.
So... if you want this feature... hack
it your self... OR... send me console application... make it as small
as possible... comment important things... and be ready to answer my
questions.