//When the user selects a row in the datagrid private void dgv_LastTransactionInfo_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (HREmployeeWorkExperienceUI.EMPWORKSearchControl.ResultsGrid.SelectedItem != null) { EditingHRWorkExperience = (HREmployeeWorkExperienceUI.EMPWORKSearchControl.ResultsGrid.SelectedItem as HR_EMP_WORK_EXPERIENCE).Clone() as HR_EMP_WORK_EXPERIENCE; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { HRWorkExperiences = HREmployeeWorkExperienceUI.EMPWORKSearchControl.ResultsGrid.ItemsSource as ObservableCollection <HR_EMP_WORK_EXPERIENCE>; HREmployeeWorkExperienceUI.EMPWORKGrid.DataContext = HRWorkExperiences; if (HRWorkExperiences.Count > 0) { EditingHRWorkExperience = HRWorkExperiences[0].Clone(); } }