I bound my grid to a strongly typed collection and I had trouble finding a way to extract and recast my selected record into the corresponding data bound object. So this is how you can do it.
private void grdInboxItems_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
// Check to make sure the selected Record is a DataRecord
if (grdInboxItems.ActiveRecord is DataRecord) {
// Cast the record passed in as a DataRecord
DataRecord myRecord = (DataRecord )grdInboxItems.ActiveRecord;
// Cast the DataRecord.DataItem into your CustomObject
CustomItem myItem = (CustomItem)myRecord.DataItem;}
Hello,
Basically this is the way you get the underlying object from the DataRecord. This code snipper should be working correctly (except if there is no ActiveRecord when you double-clicked). If you have a sample project that reproduces this issue, please attach it to your next post so that we can look into it and figure out the problem.
Regards,
Alex.