“Dialogs must be user-initiated.” with SaveFileDialog in Silverlight 3

前端 未结 5 1524
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 11:56

I am working on a Silverlight 3 app with C#. I would like to allow the user to download an image from the Silverlight app. I am using SaveFileDialog to perform the file down

5条回答
  •  误落风尘
    2020-12-10 12:46

    What this error message means is that you can only show a SaveFileDialog in response to a user initiated event, such as a button click. In the example you describe, you are not showing SaveFileDialog in response to a click, but rather in response to a completed http request (which is not considered a user initiated event). So, what you need to do to get this to work is, in the Completed event of the http request, show some UI to the user saying "download completed, click here to save the file to your computer", and when the user clicks on this message, display the SaveFileDialog.

提交回复
热议问题