Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ShowDialog return type: Form vs. Window

Tags:

.net

windows

wpf

In WPF / .Net, both System.Windows.Window and System.Windows.Forms.Form have the .ShowDialog method.

The difference is that the Windows.Window version returns a nullable bool (bool? or Nullable<bool>), while the Forms.Form version returns a straight bool.

I haven't yet seen the nullable bool ever be null, and cannot find a case where it would be in the MSDN documentation.

Can anyone explain why Windows.Window.ShowDialog returns a nullable? Should I check for it? What does it mean if I see null?

like image 483
abelenky Avatar asked Mar 19 '26 22:03

abelenky


1 Answers

see here: Window.DialogResult Property

DialogResult is null when the dialog box is shown but neither accepted nor canceled.

like image 137
Davide Piras Avatar answered Mar 22 '26 12:03

Davide Piras



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!