M
Markward
Hello everybody!
I am struggeling with data binding.
Reading the book .NET Compact Framework Programming with C# from Paul
Yao and David Durand, I got the impression, that data binding is a
technique, that is not only for Database-Objects, but also works well
with ArrayLists and such.
My Scenario ist now, that I have an ArrayList of my custom Data-Object
( a struct ). Associating the ArrayList with a ListBox or a ComboBox
works well, also the boxes are populated with the ArrayList-Items at
first.
Also the simple binding throught the boxes to Single-Value Controls
works as far, as "some" data is displayed.
My two problems are:
1.
The Controls bound by simple binding allways access the very first item
of the ArrayList, ignoring whatever item in the box is chosen. This
appears strange to me, as each of the two boxes is notified of a
changed selection in the other box.
2.
Changes made to the simple-bound controls are propagated to the
ArrayList, but don`t reflect in the Components - no update of the
visual representation.
So my questions are:
Is databinding fully functional with ArrayLists of custom Objects ?
If not, is there any workaround, that is nice programming style ?
Is data binding only für Databases-Applications, and simple scenarios
like mine should be dealt with like :
for ......{
combobox.Items.Add(..);
}
Thanks for any replys !
Markward
I am struggeling with data binding.
Reading the book .NET Compact Framework Programming with C# from Paul
Yao and David Durand, I got the impression, that data binding is a
technique, that is not only for Database-Objects, but also works well
with ArrayLists and such.
My Scenario ist now, that I have an ArrayList of my custom Data-Object
( a struct ). Associating the ArrayList with a ListBox or a ComboBox
works well, also the boxes are populated with the ArrayList-Items at
first.
Also the simple binding throught the boxes to Single-Value Controls
works as far, as "some" data is displayed.
My two problems are:
1.
The Controls bound by simple binding allways access the very first item
of the ArrayList, ignoring whatever item in the box is chosen. This
appears strange to me, as each of the two boxes is notified of a
changed selection in the other box.
2.
Changes made to the simple-bound controls are propagated to the
ArrayList, but don`t reflect in the Components - no update of the
visual representation.
So my questions are:
Is databinding fully functional with ArrayLists of custom Objects ?
If not, is there any workaround, that is nice programming style ?
Is data binding only für Databases-Applications, and simple scenarios
like mine should be dealt with like :
for ......{
combobox.Items.Add(..);
}
Thanks for any replys !
Markward