I'm asking for help with data binding in C#.
I have several classes:
[Serializable()]
public class Norma
{
public BindingList<NormElement> Parameter;
public Norma()
{
Parameter = new BindingList<NormElement>();
}
public string Name { get; set; }
}
[Serializable()]
public class NormElement
{
public decimal M { get; set; }
public decimal Sigma { get; set; }
}
so, when Norma object N (= new Norma()) comes to form in constructor, i'm doing following:
normBindingSource.DataSource = N;
textBox1.DataBindings.Add("Text", normBindingSource, "Name");
it works!
but when i'm trying to bind like this, it doesn't:
normBindingSource.DataSource = N;
textBox1.DataBindings.Add("Text", normBindingSource, "Name");
textBox2.DataBindings.Add("Text", normBindingSource, "Parameter[0].Sigma");
What am I doing wrong? Before binding, i'm checking that Parameter list is filled with numbers, all ok here. In debug i see that normBindingSource.DataSource is initialized and i can see Parameter field there.
I've tried a lot of options to succeed here, at the beginning Parameter field was just array, but then i've found that it should be with INotifyPropertyChanged, so now i came to this variant.
Thanks in advance!