private void BtnAdicionar_Click(object sender, RoutedEventArgs e) { CadCategorias cad = new CadCategorias(); cad.ShowDialog(); AtualizarDG(); }
private void OpcaoAlterar_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; ContextMenu contextMenu = (ContextMenu)menuItem.Parent; DataGrid item = (DataGrid)contextMenu.PlacementTarget; if (item.SelectedCells.Count > 0) { Categoria categ = (Categoria)item.SelectedCells[0].Item; CategoriaRepositorio repos = new CategoriaRepositorio(); CadCategorias window = new CadCategorias(); window.CategoriaAlteracao = categ; window.ShowDialog(); AtualizarDG(); } }