Even though i don't implemnt the interface INotifyPropertyChanged, the grid-objects collection works as well.
When i update object, add object into the collection, the grid refreshed successfully.
BindingList improved in new version? Could you please advise.
public partial class DataInGridDemo : Form
{
public DataInGridDemo()
{
InitializeComponent();
}
BindingList<MyCustomClass> list2;
private void DataInGridDemo_Load(object sender, EventArgs e)
{
list2 = new BindingList<MyCustomClass>() { new MyCustomClass(), new MyCustomClass() };
this.dataGridView1.DataSource = list2;
}
private void button1_Click(object sender, EventArgs e)
{
list2[0].X = 88888;
list2[1].s = "going";
list2.Add(new MyCustomClass());
list2[2].s = "aassssssss1213";
}
}
public class MyCustomClass //: INotifyPropertyChanged
{
private int x;
public int X
{
get
{
return x;
}
set
{
x = value;
//if (PropertyChanged != null)
// PropertyChanged(this, new PropertyChangedEventArgs("X"));
}
}
public string s { get; set; }
#region INotifyPropertyChanged Members
//public event PropertyChangedEventHandler PropertyChanged;
#endregion
}