Pregunta

I have a simple issue. I have a filedialog in a wpf application. Things works fine when I run the application for the first time. But when I change the file extension, and change back, I dont see anything.

This is the code:

Filedlg.FileName = "*.msr"; // Default file name
Filedlg.DefaultExt = ".msr"; // Default file extension
Filedlg.Filter = "Raw (.msr)| *.msr | All files |*.*" ; // Filter files by extension 

I see .msr files. Then I choose to see all files and then switch back to .msr extension. But I dont see any files.

Thoughts?

Kindly ask details if required.

¿Fue útil?

Solución 3

Filedlg.Filter = "Raw (.msr)|.msr|All Files(.)|.";

this one works. Problem was extra space between | All.

Otros consejos

If you are using Filter property, DefaultExt gets ignored or in worst case can cause issues. You need to use FilterIndex instead to mark default extension. You can find out more here.

I would also skip setting file name to *.msr.

try this:

Filedlg.Filter =  "Raw (.msr)| *.msr |" + "All Files(*.*)|*.*";
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top