DialogResult problem in wpf
问题 I have a window that I open a few times as a ShowDialog. Every time I open it I use the new keyword in the first time i did: var myWindow = new MyWindow(); myWindow.ShowDialog(); second time I open it from the MyWindow View Model class: new MyWindow().ShowDialog(); in MyWindow code behind I have 2 events. one is when the user clcik ok and another when the user click cancel. void OnCancel(){ DialogResult = false; } void OnOk(){ DialogResult = true; } The events fires from the View Model class