I've come across some really unexpected behavior using the OpenFileDialog, WPF, and a PocketPC (physical) device. I'm trying to let users select a file on their PocketPC using an OpenFileDialog, and when the user selects Open, WPF copies the file into the Temporary Internet Files directory, and then returns that as the path. I'm really confused as to why this happens, but here's the code to reproduce it.
Dim ofd As New Microsoft.Win32.OpenFileDialog
ofd.CheckFileExists = False
ofd.CheckPathExists = True
ofd.AddExtension = False
ofd.Filter = "Folders|\*.\*"
ofd.Multiselect = False
ofd.InitialDirectory = "C:\\"
ofd.ShowDialog()
Console.WriteLine(ofd.FileName)
When I select a file from the My Documents (eg, "\My Documents\Meeting Notes.psw") directory on my PocketPC, this is the output that is written in the console "C:\Users\*****\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\82P6MGLK\Meeting_Notes[1].psw" (Note, the astericks are used to hide my user-name). In addition to this, if you try it with a large file, the UI just freezes until the file finishes copying. Windows does not say that the program is "Not Responding", just you can't interact with the UI at all. Does anyone know why this happens? It certainly is interesting behaviour. Thanks, Mitch
modified on Thursday, June 12, 2008 1:11 AM