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