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
210
CRUD Operations
posted

I am coming from the WPF Toolkit Datagrid.  Everything I have done in WPF is using ObservableCollections.  So I was surprised your grid didn't support them if you need to AddNew.  So I created a new object that interits from ObservableCollection and Impliments IBindingList to suppor the AddNew.

What I am having a hard time figure out is how are CRUD operations supposed to be handled?  Events on the Grid?  Events on the underlining data collection?  It seems I cannot find the best way to impliment those functions?

Also, another question.  All my data is coming from LINQ queries, which I then cast to my special observable collection.  But is there a way, out of the box, to use LINQ directly with the Datagrid so I dont have to cast to something else yet still have change tracking?

I hope in the future you do support ObservableCollections.  As an experience WPF developer, that is pretty much all I use for Data Collections.

 

Parents
  • 69686
    posted

    Hello,

    Yes, the AddNewRecord in the XamDataGrid is exposed through the IBindingList interface. However, there are plenty of ways to go around this.

    You can create a wrapper around your source, which implements IBindingList or IEditableCollectionView and not actually create your custom ObservableCollection.

    Moreover, you can directly wrap your source (which is an observable collection) in a ListCollectionView or BindingList, like this:

    xamDataGrid1.DataSource = new ListCollectionView(source);

    xamDataGrid1.DataSource = new BindingList<Car>(source);

    As far as the CRUD operations, they are all supported. Are you saying that if you delete a record from the XamDataGrid, the object is not deleted from the underlying data source?

Reply Children