//When the user selects a row in the datagrid private void dgv_DocumentAttributesBankInfoModel_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (document.DABISearchControl.ResultsGrid.SelectedItem != null) { EditingDocumentAttributesBankInfo = (document.DABISearchControl.ResultsGrid.SelectedItem as ERP_DocumentAttributesBankInfo).Clone() as ERP_DocumentAttributesBankInfo; } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { DocumentAttributesBankInformation = document.DABISearchControl.ResultsGrid.ItemsSource as ObservableCollection <ERP_DocumentAttributesBankInfo>; document.DocumentAttributesBankInfoGrid.DataContext = DocumentAttributesBankInformation; if (DocumentAttributesBankInformation.Count > 0) { EditingDocumentAttributesBankInfo = DocumentAttributesBankInformation[0].Clone(); } }