I have the main WPF window, mywindow.showDialog when the button in the window is pressed, the command is executed, say, the SendToTableCommand command
protected virtual void SendToTableExecute(object o) { UIThread.BeginInvoke(new Action<object>(SendToTableExecuteUI),o); } private void SendToTableExecuteUI(object o) { if (o is Control) { m_OwningWindow = UIHelper.FindVisualParent<Window>((Control)o); } do sth... if (m_OwningWindow != null) {
Once, m_OwningWindow.DialogResult = true
throws an exception. Therefore, I added an if check using IsThreadModal. It worked for a while, but now m_OwningWindow is not closing because IsThreadModal is false.
I do not know how to solve the problem correctly and I think that I did not deal with it properly. Please help. thank you in advance
source share