Home Forums WPF controls Xceed DataGrid for WPF IList<T> and INotifyCollectionChanged enough to insert

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24097 |

    I’ve seen that the grid only supports insertion of new rows via the header row if the data source is your DataGridCollectionView. Couldn’t it also support insertion if the bound collection supports IList<T> and INotifyCollectionChanged?
    IList<T> is enough to add items to the list. If a collection supports IList<T>, reflection can easily determine the type of object in the collection, find its default constructor, create an object, and add it to the list.
    INotifyCollectionChanged is enough to tell you that the grid’s source has been updated and needs to be refreshed.

    Imported from legacy forums. Posted by mkb137 (had 972 views)

    Xceed Support
    Member
    Post count: 5658

    Using the DataGridCollectionView provides many advantages but it is not required to support insertion. As long as your collection implements IBindingList, you should have no problems inserting items through the InsertionRow.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 363 views)

    User (Old forums)
    Member
    Post count: 23064

    Even IBindingList is more than I wanted to implement, but OK.

    Thanks.

    Imported from legacy forums. Posted by mkb137 (had 3576 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.