The solution was to subscribe to the CurrentItemChanged event and then to run ReadValue() on all the controls Bindings. Here is the code that resulted.
The code only updates the myControl control, but it could have just as easily iterated through all the controls in the form and refreshed all their bindings as well.private delegate void CurrentItemChangedCallback(object sender, EventArgs e);
private void BindingSource_CurrentItemChanged(object sender, EventArgs e)
{
if(InvokeRequired)
{
CurrentItemChangedCallback d = new CurrentItemChangedCallback(BindingSource_CurrentItemChanged);
this.Invoke(d, new object[] { sender, e });
} else {
foreach (Binding b in myControl.DataBindings)
{
b.ReadValue();
}
}
}
No comments:
Post a Comment