Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
790
Adding child row failing when using BindingList<T>
posted

Hi,

I have a recursive data structure which I am binding to the grid. I have a class "Patient" which Implements INotifyPropertyChanged and has another property  public BindingList<Patient> Children. Which can have recursive objects. I am creating BindingList<Patient> to bind to the grid.
Everything works fine until I try to add another child at run time to a row which does not have anything in "Children" Property. Nothing happens. I am attaching a sample can some one please let me know what I am doing wrong here?

WinGridBindingList.zip
Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    The sample you posted here is not a recursive data source. There is no Children property on your Patient object. I also don't see anything in this sample that would allow me to add a row to the grid, the datasource or any child data.

    Did you post the wrong sample?

    My guess is that your Children property was returning Null instead of an empty collection - that would explain why you can't add child rows. But that's just a guess.

Children