private void btIncluir_Click(object sender, RoutedEventArgs e) { try { TributIcmsCustomDetDTO detalheDTO = new TributIcmsCustomDetDTO(); detalheDTO.IdTributIcmsCustomCab = ((TributIcmsCustomCabViewModel)DataContext).TributIcmsCustomCabSelected.Id; ((TributIcmsCustomCabViewModel)DataContext).TributIcmsCustomDetSelected = detalheDTO; TributIcmsCustomDet viewDetalhe = new TributIcmsCustomDet(); viewDetalhe.btSair.Click += new RoutedEventHandler(btSair_Click); viewDetalhe.btGravar.Click += new RoutedEventHandler(btGravar_Click); tabDetalhe.Content = viewDetalhe; tabDetalhe.IsSelected = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
private void btConsultar_Click(object sender, RoutedEventArgs e) { try { if (((TributIcmsCustomCabViewModel)DataContext).TributIcmsCustomDetSelected != null) { tabDetalhe.IsSelected = true; TributIcmsCustomDet viewDetalhe = new TributIcmsCustomDet(); viewDetalhe.btSair.Click += new RoutedEventHandler(btSair_Click); viewDetalhe.btGravar.Click += new RoutedEventHandler(btGravar_Click); tabDetalhe.Content = viewDetalhe; } else { MessageBox.Show("Selecione um elemento na lista.", "Alerta do sistema"); } } catch (Exception ex) { throw ex; } }