//When the user selects a row in the datagrid private void dgv_Warning_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (Warning.WarningSearchControl.ResultsGrid.SelectedItem != null) { EditingWarningInfomation = (Warning.WarningSearchControl.ResultsGrid.SelectedItem as HR_EMP_WARNINGS).Clone() as HR_EMP_WARNINGS; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { WarningInformation = Warning.WarningSearchControl.ResultsGrid.ItemsSource as ObservableCollection <HR_EMP_WARNINGS>; Warning.WarningGrid.DataContext = WarningInformation; if (WarningInformation.Count > 0) { EditingWarningInfomation = WarningInformation[0].Clone(); } }