protected override void OnKeyUp(KeyEventArgs e) { if (e.Key == Key.Escape) { TaskDialog td = Content as TaskDialog; if (td != null) { if (td.OnEscape()) { // Closing. return; } } } base.OnKeyUp(e); }