//When the user selects a row in the datagrid private void dgv_CustomerSupplier_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (CustomerSupplier.CusSupInfoSearchControl.ResultsGrid.SelectedItem != null) { EditingCusSupInfo = (CustomerSupplier.CusSupInfoSearchControl.ResultsGrid.SelectedItem as FIN_CustomerSupplier_Info).Clone() as FIN_CustomerSupplier_Info; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { LastCusomerSupplierInformation = CustomerSupplier.CusSupInfoSearchControl.ResultsGrid.ItemsSource as ObservableCollection <FIN_CustomerSupplier_Info>; CustomerSupplier.CusSupInfoGrid.DataContext = LastCusomerSupplierInformation; if (LastCusomerSupplierInformation.Count > 0) { EditingCusSupInfo = LastCusomerSupplierInformation[0].Clone(); } }