private void HaloMap_Closing(object sender, CancelEventArgs e) { LayoutDocument ld = (LayoutDocument)sender; HaloMap mp = (HaloMap)ld.Content; mp.Dispose(); }