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