I have a class like this one :public class Car{ private string _color; public string Color { get { return _reference; } set { _reference = value; } }......}
I bind the cars to the xamDataGrid like thisList<Car> myList;myXamDataGrid.DataSource = myList;
Everything is good until I try to get the car I select into the grid. How can I get the 'Car' objet that is selected?
Thanks
Thank you very much Joe,it works fine, great job
The XamDataGrid exposes an ActiveRecord property, along with associated RecordActivating and RecordActivated events. The ActiveRecord property returns a Record base class which would need to be cast to a derived DataRecord. The DataRecord has a property off it called DataItem which will return the Car object, e.g.:
DataRecord dr = this.xamDataGrid1.ActiveRecord as DataRecord;
if ( dr != null )
{
Car car = dr.DataItem as Car;
}