//When the user selects a row in the datagrid void dgv_EmergencyContact_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (EmergencyContact.EmergencyContactSearchControl.ResultsGrid.SelectedItem != null) { EditingEmergencyContactInfomation = (EmergencyContact.EmergencyContactSearchControl.ResultsGrid.SelectedItem as HR_EMP_EMERGENCY).Clone() as HR_EMP_EMERGENCY; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { EmergencyContactInformation = EmergencyContact.EmergencyContactSearchControl.ResultsGrid.ItemsSource as ObservableCollection <HR_EMP_EMERGENCY>; EmergencyContact.EmergencyContactGrid.DataContext = EmergencyContactInformation; if (EmergencyContactInformation.Count > 0) { EditingEmergencyContactInfomation = EmergencyContactInformation[0].Clone(); } }