//When the user selects a row in the datagrid private void dgv_AccountType_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (benefit.CashBenefitSearchControl.ResultsGrid.SelectedItem != null) { EditingLastBenefitInfo = (benefit.CashBenefitSearchControl.ResultsGrid.SelectedItem as HR_CASH_BENEFIT).Clone() as HR_CASH_BENEFIT; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { LastBenefitInformation = benefit.CashBenefitSearchControl.ResultsGrid.ItemsSource as ObservableCollection <HR_CASH_BENEFIT>; benefit.CashBenefitGrid.DataContext = LastBenefitInformation; if (LastBenefitInformation.Count > 0) { EditingLastBenefitInfo = LastBenefitInformation[0].Clone(); } }