I am working on an application that displays some child windows that can be closed by the user or automatically closed. When debugging some of the exceptions that were thrown, I found that I was trying to call methods such as Hide() in an already closed window; this particular code branch was common to both cases, and I did not notice this.
One of my first ideas was to look for a property on the Window that would indicate that the window was closed. I can't seem to find him. In WinForms, I would look at the IsDisposed property for a somewhat reliable indicator that the form was closed (it will not work reliably for dialogue, but I do not work with dialog boxes.) I do not see anything equivalent to Window . The documentation for Window.Close() does not appear to indicate any properties that have been modified by the method. Am I missing something obvious or is this the only way to find out if the window is closed to handle the Closed event? This seems like a harsh requirement for a simple task.
wpf
OwenP Dec 19 '08 at 19:32 2008-12-19 19:32
source share