private void BtnAddNewMainRow_Click(object sender, RoutedEventArgs e) { if (TabStyle != null) { switch (TabStyle.SelectedIndex) { case 0: _viewModel.AddNewDetailRow(DetailGrid.SelectedIndex != -1); //_viewModel.SelectedDetailRow.TblSupplier = (int)_RequestforSampleViewModel.SelectedMainRow.TblSupplier; //_viewModel.SelectedDetailRow.SupplierPerRow = _RequestforSampleViewModel.SelectedMainRow.SupplierPerRow; //_viewModel.SelectedDetailRow.TblRequestForSample = _RequestforSampleViewModel.SelectedMainRow.Iserial; //_viewModel.SelectedDetailRow.RequestforSamplePerRow = new TblRequestForSample().InjectFrom(_RequestforSampleViewModel.SelectedMainRow) as TblRequestForSample; break; case 1: _viewModel.AddNewSalesOrderOperation(SalesOrderOperationGrid.SelectedIndex != -1); break; case 2: _viewModel.AddNewSubEventRow(SubEventGrid.SelectedIndex != -1); break; case 3: _viewModel.AddBom(BomGrid.SelectedIndex != -1); break; } } }