Help on file open dialogue

Mar 7, 2012 at 3:11 PM


I need help to make two file open dialogues open only selected file types.

I use string properties with 


, but the default extension doesn't seem to do the trick. I've tried using a .txt filter as well.

Mar 7, 2012 at 5:39 PM

This should be correct, can you set a breakpoint in the FilePicker.Browse method and check if the DefaultExtension is passed correctly?

Mar 7, 2012 at 8:24 PM

I'm not sure what you mean, could you specify?

I use the PropertyTools version from NuGet. Basically, what I have is:

		[FilePath(".txt"), other annotations...]
		public string MyFilePathProperty { getset; }
Mar 7, 2012 at 8:42 PM

You need to get the source code to be able to debug the FilePicker control.

The TestFilePathAttribute example in the PropertyControlDemo seems to work.

See also ("If the extension cannot be determined from the Filter property, DefaultExt will be used instead.")

The AddExtension property is true (default) in the file dialogs.

Mar 8, 2012 at 11:08 AM

It works when you make a filter. This works:

[FilePath("Text file |*.txt"".txt")]