Microsoft.Win32.OpenFileDialog.ShowDialog()何时返回null? [英] When does Microsoft.Win32.OpenFileDialog.ShowDialog() return null?

查看:137
本文介绍了Microsoft.Win32.OpenFileDialog.ShowDialog()何时返回null?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenFileDialog ShowDialog 方法返回可为空的布尔值,如果用户单击确定",或者单击取消",则返回false.什么时候返回null?该文档没有说.

OpenFileDialog's ShowDialog method returns a nullable boolean, set to true if the user clicked OK or false if he clicked Cancel. When does it return null? The documentation does not say.

推荐答案

下面的链接中对此进行了说明,但在这里我会提到

This is stated in the questions linked below, but I'll mention here that Programming WPF (Chris Sells, Ian Griffiths) says:

ShowDialog将始终返回true或 错误的. ...仅在对话结束后 已显示,但在关闭之前 DialogResult为空.

ShowDialog will always return true or false. ... Only after a dialog has been shown but before it's been closed is DialogResult null.

类似的问题:何时ShowDialog()返回null?

并且:为什么DialogResult在WPF中是可为空的布尔值?

这篇关于Microsoft.Win32.OpenFileDialog.ShowDialog()何时返回null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆