WPF ShowDialog returns null immediately on second call

前端 未结 2 1978
猫巷女王i
猫巷女王i 2021-02-19 05:36

I think this is a bug in the WPF framework, without going into depths of my program and why I am doing what I am doing, I wrote a simple test application to prove my theory.

2条回答
  •  不要未来只要你来
    2021-02-19 05:59

    Not a bug. The default ShutdownMode of Application is OnLastWindowClosed, so as soon as the first window is closed your application will start shutting down! Change to OnExplicitShutdown and it will work, but you'll have to manage the shutdown.

    I think you probably just need to rethink what you're actually trying to achieve. Why would you display two subsequent dialog windows during the startup of your app?

提交回复
热议问题