ookii-dialogs / ookii-dialogs-wpf

Awesome dialogs for Windows Desktop applications built with Microsoft .NET (WPF)
BSD 3-Clause "New" or "Revised" License
1.14k stars 85 forks source link

Update FilterIndex after ShowDialog of Save Dialog #45

Open barnacleboy opened 3 years ago

barnacleboy commented 3 years ago

Hi there!

Thanks for maintaining the good old ookii-dialogs assemblies! I would suggest the following enhancement:

Think of the scenario where you have a Save Dialog that has the following 2 filters:

Both filters have the same extension (XML) but after defining the file name in the dialog, you want to know which filter index was set in the dialog to decide if we save the XML in version 1 or version 2 of the data format.

After debugging and scrolling through the code, I've found out that the VistaSaveFileDialog never gets the filter index back after FileOk - unfortunately there are also no possibilites to customize the behavior manually, since the FileOk event only provides the CancelEventArgs.

I think this would be a good addition to the File Dialogs since I remember this worked in the original ones from Microsoft. Best place to implement this would be the GetResult method I guess...

Regards, barnacleboy

augustoproiete commented 3 years ago

Thanks @barnacleboy. That makes sense to me.

Feel free to submit a PR, otherwise I'll get to it when I have a chance.