Quantcast
Viewing all articles
Browse latest Browse all 18858

OpenFileDialog hangs when clicking an item in Tree View(ie: pictures,music..)

Hi,

I'm developing a WPF application and I need to use the Openfiledialog class. OpenFileDialog launches fine and I can navigate through any file without any issue except for the Libraries option under the tree view. Eg: If I click on pictures ,music under the libraries,the application hangs and after a delay it opens the folder. Whereas, if i manually open the folder ie through C:\Users... there is no issue at all. My code is :

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();


            dlg.Filter = "Image Files (.png)|*.png|Image Files (.jpeg)|*jpeg |Image Files (.jpg)|*jpg";
            dlg.InitialDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Images";


            Nullable<bool> result = dlg.ShowDialog();

When the application hangs I do not get any exception as well. My application (which calls the openfiledialog) runs as a shell application. I don't want to open the filedialog through a different application.

PS: I have also tried the System.Windows.Forms.OpenFiledialog,the same issue is present there as well

Can someone explain why this behavioral change in the openfiledialog ? 


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>