public void btnAddGadget_Click(object sender, RoutedEventArgs e) { Gadget_hinzufügen window = new Gadget_hinzufügen(); if (window.ShowDialog() == true) { mainWindow = (MainWindow)Window.GetWindow(this.Parent); // Update DataGrid mainWindow.RefreshDataGrid(); } }