BindingSources DataBinding Positioning

Topics: CAB & Smart Client Software Factory
Apr 26, 2006 at 10:37 AM
originally posted by: KrijnMichiels

Most of the CAB projects I've seen uses the EventBroker to notify SmartParts on dataposition changes. Suppose we put a BindingSource object in our WorkItem.State and use something like :

Public WriteOnly Property CustomerSource as BindingSource
Set(value as BindingSource)
Me.CustomerBindingSource = value
end Set

Obviously this does not work. The smartpart bindingsource with all databindingstatements gets overridden and all bindings are lost. I guess this is the reason why everyone (?) uses EventPublications like :

<EventSubscription("CustomerChanged")> _
Public Sub CustomerChanged(sender as Object, e as CustomerChangedEventArgs)
Me.CustomerBindingSource.DataSource = e.Customer
End Sub

Would anyone be interested in a more Databinding approach where smartpart data is directly bound to WorkItem state ? Or is everyone waiting for WPF ; SmartPart.DataContext = State("SmartPartStateKey") !!

Example setting :
- One View
- multiple SmartParts; CustomerList, CustomerDetail, Orders
- WorkItem initializes :
State("Customers") = New BindingSource(dsCustomers,"Customers"))
State("CustomerOrders") = New BindingSource(State("Customers"), "CustomerOrders"))
- each SmartPart gets BindingSource objects injected
- add databindingstatements
- application works