In the ProjectEdit control sample, the parent is bound to a form, and the child collection is bound to a datagrid. So the RebindUI() looks like:
private void RebindUI(bool saveObject, bool rebind)
{
this.projectBindingSource.RaiseListChangedEvents = false;
this.resourcesBindingSource.RaiseListChangedEvents = false;
try
{
UnbindBindingSource(this.resourcesBindingSource, saveObject, false);
UnbindBindingSource(this.projectBindingSource, saveObject, true);
.............
}
}
My question is: if the UI only contains a datagrid which is bound to child collection and parent object is NOT bound to any control/form, can we reduce the above code to the following and do NOT need to care about parent bindingsource?
private void RebindUI(bool saveObject, bool rebind)
{
this.resourcesBindingSource.RaiseListChangedEvents = false;
try
{
UnbindBindingSource(this.resourcesBindingSource, saveObject, false);
......
}
}
Hi,
Yes, you are not required to bind the parent to a BindngSource when the parent is not used for any databinding in the UI.
Copyright (c) Marimer LLC