I am trying to add new row to xamgrid and i keep getting error Exception Details: System.NotSupportedException: Collection isread-only.
Hi,
What type of collection are you using?
We only support adding/removing from IList and IEditableCollectionViews. If you're using a ReadOnlyCollection, then we won't be able to use that either.
-SteveZ
I am using EntityFramework and I am able to update data but not add
If you're using an EntityCollection, they don't implement IList or IEditableCollectionView. They just have an Add method, thats not exposed via an interface, so there is no way for us to detect that it exists.
What you can do instead, is use the RowAdding event, cancel it, and perform the add yourself:
this.grid.RowAdding += new EventHandler<CancellableRowAddingEventArgs>(grid_RowAdding);
void grid_RowAdding(object sender, CancellableRowAddingEventArgs e)
{
e.Cancel = true;
yourCollection.Add(e.Row.Data);
}
Hope this helps,
In order for the xamGrid to automatically show the newly added item, the collection needs to implement INotifyCollectionChanged.
Yes I have added the event, but I dont see row getting added to the grid after its added in UI
Could you be more specific?
What isn't getting triggered?
What actions are you trying to perform?
Did you attach the event?
Thanks,
I did as you mentioned but it isnt getting triggered when I move to any other row