Refresh content of one window by opening new window in wpf

I am setting the data context

second window with the selected row of my data grid like this:

newdialog.DataContext=myGrid.SelectedItem;

      

what i want to do is when i change the values ​​in the new window and click ok and then update the data of the selected row in myGrid. The problem is that I am changing the data in the new window before clicking OK. It updates the data in myGrid in my first window (even when I cancel the second window).

What else should I write to display the data of the selected row in the second window? And correctly update the data in the first window. When the user clicks OK, the below conditions will be true.

if (newdialog.ShowDialog() == true)
{                   
   // Something...                         
}   

      

+3


source to share





All Articles