SaveFileDialog behavior when SupportMultiDottedExtensions is set to true

  • Thread starter Thread starter mayertj12
  • Start date Start date
M

mayertj12

Guest
I have the following code (fragment):

using (SaveFileDialog sd = new SaveFileDialog())
{
sd.SupportMultiDottedExtensions = true;
sd.Title = "Save Test";
sd.InitialDirectory = "My.Computer.FileSystem.SpecialDirectories.Desktop";
sd.Filter = "TEST1|*.proj1.zip|TEST2|*.proj2.zip";
sd.FileName = "TEST.proj1.zip";
sd.AddExtension = false;
DialogResult r = sd.ShowDialog();
}

When I run this on various version of Windows 10 with slightly different .NET version installed, the behavior is very different - and in all cases isn't what's expected. On some systems it continuously appends a suffix from the Filter as the filter type is changed. On other systems it simply blanks out the entered filename.

If i remove the multi-dotted extension, and replace the filter with simpler expressions, it seems to do what I would expect, updating ONLY the extension when a different filter option is selected.

Ideally the save file dialog produces a filename and path that matches the filter exactly as the user wants, otherwise this will cause confusion.

I've tried a lot of different property values for SaveFileDialog, but none of them seem to work for me. Is SupportMultiDottedExtensions broken or am I missing something?

Continue reading...
 
Back
Top