//When the user selects a row in the datagrid private void SearchControl_SelectionChanged(object sender, SelectedCellsChangedEventArgs e) { if (bank.BankBranchSearchControl.ResultsGrid.SelectedItem != null) { EditingBankBranch = (bank.BankBranchSearchControl.ResultsGrid.SelectedItem as FIN_BankBranch).Clone(); } }
//This is a event which fires whenever newitems arrive at the datagrid private void ItemSourceChanged(object sender, EventArgs e) { BankBranches = bank.BankBranchSearchControl.ResultsGrid.ItemsSource as ObservableCollection <FIN_BankBranch>; bank.BankBranchGrid.DataContext = BankBranches; if (BankBranches.Count > 0) { EditingBankBranch = BankBranches[0].Clone(); } }