protected override void OnClosed(EventArgs e) { TaskDialog td = Content as TaskDialog; if (td != null) { td.OnClosing(); } Content = null; base.OnClosed(e); }