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
465
Adding a new row omits the collection field
posted

When adding a new datarow all fields of simple types are shown and can be given a value to be inserted.

1) However if I have a field of type List<int>, I can't even see that field shown on the grid. Since its within the plus sign underneath the row.  Therefore populating a test row within the ctor works as intented, but I see no way how to populate the collection fields from the grid.

2) Once this is solved for List<int>, how would I do the same thing for a collection of custom classes? List<customClass> ?

Many Thanks for your advice,

Houman

  • 69686
    posted

    Hello Houman,

    If you have a hierarchical XamDataGrid, you would first need to add the top level item and then once it is added, you can add the nested one. In your scenario, as you have a property of type collection, you would first have to commit the parent data record, then expand it and fill the nested data record. However, as the AddNewRecord UI is exposed through the IBindingList interface, you will have to change the List to BindingList<T> or wrap it inside a collection - BindingListCollectionView / ListCollectionView (or Implement IBindingList).