//When the user selects a row in the datagrid void dgv_CostCenter_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (costcenter.CCSearchControl.ResultsGrid.SelectedItem != null) { EditingCostCenter = (costcenter.CCSearchControl.ResultsGrid.SelectedItem as FIN_CostCenter).Clone() as FIN_CostCenter; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { CostCenterInformation = costcenter.CCSearchControl.ResultsGrid.ItemsSource as ObservableCollection <FIN_CostCenter>; costcenter.CostCenterGrid.DataContext = CostCenterInformation; if (CostCenterInformation.Count > 0) { EditingCostCenter = CostCenterInformation[0].Clone(); } }