WPF线程内弹出其他窗口

           System.Threading.Thread td = new System.Threading.Thread(() => {
                    System.Windows.Window fm = new System.Windows.Window();
                    fm.Topmost = true;
                    fm.ShowDialog();
                });
                // 将当前线程设置为单个线程单元(STA)模式方可进行 OLE 调用。
                td.TrySetApartmentState(System.Threading.ApartmentState.STA);    //<< ~~~~~~~~~~~~~~~~~~~~加上这句话就可以解决问题了
            // 设置为后台线程
            td.IsBackground = true;
                // 开启线程
                td.Start();

猜你喜欢

转载自blog.csdn.net/u014090257/article/details/119795281
今日推荐