首页 > 技术文章 > WPF 主窗口关闭时结束所有相关线程

dhqy 原文

程序主窗口的 Closed 事件中添加代码:

Process.GetCurrentProcess().Kill();

推荐阅读