List<Employee> employees = Service.GetEmployees();
xamDataGrid1.DataSource = employees;
How can I get the selected item in terms of an Employee object.. the docs only mention get the selected row and then retrieving stuff via cell values...
Found solution:
PersonEntity selectedPerson = ((Infragistics.Windows.DataPresenter.DataRecord)(xamDataGrid1.SelectedItems.Records[0])).DataItem as PersonEntity;
Note that selection and activation are 2 separate concepts in the XamDataGrid. You can have 0 or more selected records at any time but there is only ever 1 active record.
If you are interested in the selected records then the solution you describe should work. If you want the active record then do this:
PersonEntity pe = null;
DataRecord dr = XamDataGrid1.ActiveRecord as DataRecord;
if ( dr != null ) pe = rd.DataItem as PersonEntity;
etc.
Note: the reason that you need to cast to a DataRecord is because ActiveRecord returns the Record base class since it could also be an instance of a GroupByRecord or an ExpandableFieldRecord.