I am trying to add new row to xamgrid and i keep getting error Exception Details: System.NotSupportedException: Collection isread-only.
In order for the xamGrid to automatically show the newly added item, the collection needs to implement INotifyCollectionChanged.
-SteveZ
Yes I have added the event, but I dont see row getting added to the grid after its added in UI
Hi,
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
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,