Environmental summary:
I encountered an obstacle with my Visual Studio WPF (not Core) app.
I created 2 different Windows, one of them is a MainWindow, where the software displays the data in ListBox with Binding, and the second one is a simply Add Data window.
In a MainWindow, if I click on "Add new element" button, it will show up the new window (mainWindow still displayed under), like this:
ModifyDetails details = new ModifyDetails(ListViewPositions.SelectedItem as Positions);
details.Show();
If I finished with filling up my form I press the save button. It will update the Database, and close the window simply like this:
...Database updating...
this.Close();
So the problem is that I want to Refresh my ListBox after I close the "Add new element" window. I can Refresh it with a button on MainWindow, so the process is good, but I'm looking for an Closing event, or something to make it automatic.
Refresh process:
public void Refresh()
{
positions.Clear();
positions = GetProducts();
ListViewPositions.ItemsSource = positions;
ListViewPositions.Items.Refresh();
}
question from:
https://stackoverflow.com/questions/65844801/wpf-popup-window-closed-event 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…