I create a new WPF Windows using the following code:
var window = new Window();
window.Title = draggingTabItem.Header as string;
window.Content = stateViewer; // this is an UserControl, it works
window.LocationChanged += Window_OnLocationChanged;
window.Show();
No when lateron I call
SelectedWindow.Close()
I get DisconnectedContext exception. I cannot find any information about this exception. What is this exception about and how do I resolved it?
I found this answer on MSDN, but I would like to have something which doesn't throw the error in the first place.