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