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
405
WinGrid with ObservableCollection list
posted

I have been using the CSLA 2 framework to create business objects that bind to UltraGrids. This has been working for a number of years. I am in the process of upgrading to CSLA 4.2 and have found that when I click the "Add" button on the grid I get the following error message: "Unable to add a new row. The underlying DataSource does not support adding new rows".

The list object of this frame ultimately inherits from ObservableCollection. I get the same error if I bind the grid to a list of ObservableCollection(Of Test) where "Test" is just an object with a few properties. I've noticed that if I bind the grid to a list of ObservableCollection(Of String) everything works fine.

I've created a test project to try and show and explain the error maybe a bit better.

GridObservableList.zip
Parents
No Data
Reply
  • 29045
    Suggested Answer
    Offline posted

    Hello acronwright,  

    You can add new rows by inheriting from BindingList(of Test) instead of using an ObservableCollection. ObserableCollection does not derive from BindingList. The way your sample is setup currently you will not be able to add or delete rows, as this is by design. 


    Inherits System.ComponentModel.BindingList(Of Test)

    For more information please refer to our documentation page under "Create Custom Business Objects"
    http://help.infragistics.com/Doc/WinForms/Current/CLR4.0/

    Let me know if this helps. I was able to simply change the line 12 under your class, run and click "TestList" to add a new row. By any means if you require to use an ObservableCollection you can submit a product idea at ideas.infragistics.com

     

Children
No Data