100 likes | 121 Views
Explore the power of databinding with Delphi for .NET, including simple and complex binding, using binding managers, dataflow samples, and navigating collections. Learn to show changes efficiently and implement 2-way binding with custom parsing and formatting.
E N D
Databinding Overview • Simple Binding • The binding of a control to a public property of a class • Complex Binding • The binding of a control to a class that supports a list • Specifically the list object must support the IList interface.
Databinding Binding Managers • Currency Manager • Simple and Complex Binding • Uses Interfaces or reflection to bind • Property Manager • Simple Binding • Uses reflection to bind
Databinding Dataflow
Sample Code
Databinding Collections • Must Implement IList • Most convenient to inherit from CollectionBase • Must implement a default Array property called Item • Member class properties must be published
Databinding Navigating the collection • CurrencyManager • Position, read and write, so can increment and decrement • Current, contains the selected object • Refresh, update the bound component.
Databinding Showing changes • The cheats way – Currency Manager, refresh • IBindingList • Change Notification • Automatic Addition of Items • Automatic Removal of Items • In place Editing • Searching • Sort
Databinding Simple binding • 2 way, but there is a trick to it • Implement a propertynameChanged event • Binding class allows us to provide custom parsing and formatting.
Databinding Thanks to • References • http://www.codeproject.com/vb/net/databindingconcepts.asp • http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q313482 • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet02252003.asp