Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simple data binding to a property
Message
 
 
À
11/09/2003 16:59:48
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00828163
Message ID:
00828367
Vues:
20
>IListSource interface ...

Well, that *sounds* good, but the only classes that implement IListSource are DataSet and DataTable. If binding to a property was dependent on it's parent object implementing IListSource, then the binding wouldn't work on a TextBox.

My guess is that IListSource is needed for complex binding, since part of the interface returns an Ilist.

Now that I've taken a minute to look into this, I note that TextBox implements *no* interfaces. In going up the heirarchy, the first ancestor to TextBox that implements any interfaces (ISynchronizeInvoke looks like a possible candidate) is System.Windows.Forms.Control, which is also an ancester of System.Windows.Forms.Form, so that can't be the requirement.

From the docs on the Binding class:

"Use the Binding class to create and maintain a simple binding between the property of a control and either the property of an object, or the property of the current object in a list of objects."

Hmmm... Looking further at the documentation for the Binding class, it says that the DataSource must implement IBindingList, ITypedList or IList, but neither the TextBox nor any of its ancestors implements any of these, so why can I bind the Text property of one TextBox to the Text property of another?

What's interesting is the documentation of ITypedList says you don't have to implement ITypedList to bind data, that you can bind data to an array, but I tried to create the property as a one-element array, but get the same error. Tried an ArrayList too!

Ya know, a year from now this will be so easy and so intuitive! <s>
>>-Steve->>

Steve Sawyer
Geeks and Gurus, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform