Perhaps I misunderstood your problem, I thought that it was that the ListBox was not automatically reflecting changes to the underlying DataSource List. The BindingList raises events that would cause the ListBox to update automatically when the List changes. Here is a simple example. New WinForm project with two buttons and two ListBoxes. Clicking Button1 adds items to the underlying lists, but only the ListBox with the BindingList as the DataSource is update. Clicking Button2 tells ListBox1 to Refresh it's data.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<int> L1 = new List<int>();
BindingList<int> L2 = new BindingList<int>();
private void Form1\_Load(object sender, EventArgs e)
{
L1.Add(1);
L1.Add(2);
L2.Add(11);
L2.Add(22);
listBox1.DataSource = L1;
listBox2.DataSource = L2;
this.button1.Click += new System.EventHandler(this.button1\_Click);
this.button2.Click += new System.EventHandler(this.button2\_Click);
}
private void button1\_Click(object sender, EventArgs e)
{
L1.Add(3); // adds a value to L1, but listBox1 does not display it until the binding is refresshed
L2.Add(33); // adds a value to L2 and listBox2 is automatically refreshed to display it
}
private void button2\_Click(object sender, EventArgs e)
{
// tell listBox1 to refresh the data
((CurrencyManager)this.BindingContext\[L1\]).Refresh();
}
}
}