2
有时,当我在WPF的OpenFileDialog窗口上调用ShowDialog时,对话框立即以返回值false关闭。WPF ShowDialog立即返回
我打电话给ShowDialog以响应按钮单击事件。我可以通过MSDN上的打开文件对话框的示例代码重现此问题:当我运行从Visual Studio 2008 SP1我在调试模式下的解决方案出现
// Configure open file dialog box
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document"; // Default file name
dlg.DefaultExt = ".txt"; // Default file extension
dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension
// Show open file dialog box
Nullable<bool> result = dlg.ShowDialog();
// Process open file dialog box results
if (result == true)
{
// Open document
string filename = dlg.FileName;
}
问题间歇性。这很烦人。
这是一个已知的问题?有解决方法吗?
对于它的价值,我试图重现这个问题,并没有能。我使用VS 2008 SP1,Win7 64位。 – 2010-05-11 16:15:41
Buggy外壳扩展? – 2010-05-12 00:31:39
@Ben我正在使用Windows XP。 @Per有可能我可以有一个错误的shell扩展......我怎么能确定这是否是我的问题的原因? – dthrasher 2010-05-12 14:21:34