I’m using the http://wpfmdi.codeplex.com/ library to handle MDI in my WPF application.
I’ve got a Canvas which contains a child container, which in turn contains a number of small windows. I would like to perform an action when one of the small windows is closed, so I tried to do the following:
MdiChild child = new MdiChild();
child.Closing += new RoutedEventHandler(DatabaseTableWindow_Closing);
private void DatabaseTableWindow_Closing(object sender, RoutedEventArgs e)
{
object s = e.Source;
}
While the method is successfully entered when a window is closed, e.Source is null. I’ve also checked the sender and that is null too. All I want is a way to find out which window fired the event.
If the
senderisnull, then it sounds like an oversight/bug in the MDI framework you are using. Since you have the source, you can fix it: locate the place(s) where theClosingevent is raised, and addthisas the sender. That should give you a reference to theMdiChildwhen you are handling the event.