Version

Changing Cell Values in Code Behind

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

The xamGrid™ control allows editing of its cells through the row’s Data property. The property returns the data item the row is bound to. You should not attempt to edit a cell individually using the cell’s Value property, as this is read-only. Your data items must implement the INotifyPropertyChanged interface for the changes to be reflected in the row of xamGrid. Further, if you are planning to add and remove data items from your collection, you must implement the INotifyCollectionChanged interface for changes to be reflected.

The following code shows you how to access the data from a row of xamGrid and modify a data field.

In Visual Basic:

Dim row As Row = Me.xamGrid1.Rows(0)
Dim product As Product = TryCast(row.Data, Product)
product.ProductName = "Ice Cream"

In C#:

Row row = this.xamGrid1.Rows[0];
Product product = row.Data as Product;
product.ProductName = "Ice Cream";