我有一个类 Sample,还有一个子类 SampleTests。在演示者类中,我有 BindingList(Of Sample) 属性 CurrentSamples。演示者还有一个 AddTest 方法,该方法将测试添加到绑定列表中的指定样本。
在表单中,有一个绑定到演示者的 CurrentSamples 属性的 SampleBindingSource。还有一个 SampleTestBindingSource 将 SampleBindingSource 作为其 DataSource 并将其 DataMember 设置为 SampleTest。
我已经验证,当我使用 AddTest 方法时,测试确实被添加到该样本中。我还通过遍历 bindingsource 记录并计算每条记录上的测试数来验证 SampleBindingSource 具有添加的测试。但是,如果我在具有两个测试的示例的 SampleTestBindingSource 中显示记录数,SampleTestBindingSource 只显示一个记录/测试。
我已经在演示者的绑定列表、SampleTestsBindingSource 和 SampleBindingSource 上尝试了 ResetBindings。我也在两个绑定源上尝试过 EndEdit。这些尝试都不会将 SampleTests 中的更改传播到 SampleTestsBindingSource。
如何让演示者中的更改一直传播到 SampleTestsBindingSource?