views:

695

answers:

2

I have a Silverlight 3 app that that will let users download PDF files of static content. The problem is that the SaveFileDialog in Silverlight 3 does not allow you to specify the default filename that appears in the dialog box. This means that users have to type the name themselves and this is confusing for them since they are accustomed to a "simple" save dialog which only asks them to either Save or Cancel. All users are using IE7 or IE8.

I've tried to find a solution by the following methods:

  • Open the file new window using HtmlPage.Window.Navigate hoping to prompt a download (which obviously fails since it opens the file in a new window)
  • Using the SaveFileDialog (which we don't want to use for the aforementioned reason)

How can a file be downloaded in Silverlight such that a user-initiated save dialog only gives users the option to Save/Cancel instead of prompting to type a file name?

A: 

Did you try setting the default extension on the SaveFileDialog? See MSDN documentation: http://msdn.microsoft.com/en-us/library/system.windows.controls.savefiledialog.defaultext%28VS.95%29.aspx

KeithMahoney
Absolutely. The default extension is listed, which is a good thing, but the users are still prompted to enter a filename.
Alison
A: 

This is a well-known issue with SL3 SaveFileDialog. Unfortunately, there is currently nothing on the horizon that says it will get fixed other than someone at MSFT saying something to the effect of "if we have some time, we'll fix it for SL4". There is a bit of a riot by developers over at http://forums.silverlight.net/forums/p/117702/265216.aspx.

Otaku
Maybe so but I've seen Silverlight apps with "Download" links that do launch a prompt where the user can simply click "Save".SaveFileDialog isn't the issue since I don't want to use it. I just want users to be able to save a file without any hassle.
Alison

related questions