Why is DialogResult a nullable bool in WPF?

后端 未结 5 670
逝去的感伤
逝去的感伤 2021-01-17 08:59

Can anyone think of a good explanation for the fact that result of a dialog is a nullable bool in WPF? This has always baffled me. In WinForms it was an enum type and that m

5条回答
  •  隐瞒了意图╮
    2021-01-17 09:22

    ShowDialog will always return true or false. DialogResult will only take the null state when the dialog is open. Transitioning from null to true or false will close the dialog and make the original call to ShowDialog return.

提交回复
热议问题