1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| SynchronizationContext m_synchronizationContext = null;
public Form1()
{
InitializeComponent();
m_synchronizationContext = WindowsFormsSynchronizationContext.Current;
foreach(System.ComponentModel.Component l_component in this.components.Components)
{
if (l_component is BindingSource)
{
BindingSource l_bindingSource = (BindingSource)l_component;
bool l_res = l_bindingSource.IsSynchronized;
l_bindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(l_bindingSource_ListChanged);
}
}
StartWorkflow();
}
void l_bindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
((BindingSource)sender).ListChanged -= new System.ComponentModel.ListChangedEventHandler(l_bindingSource_ListChanged);
m_synchronizationContext.Send(new SendOrPostCallback(delegate
{
((BindingSource)sender).ResetBindings(false);
}), null);
((BindingSource)sender).ListChanged += new System.ComponentModel.ListChangedEventHandler(l_bindingSource_ListChanged);
} |
Partager