在 Silverlight SaveFileDialog 中打开文件而不是保存文件
在 Silverlight 中,有一个 SaveFileDialog,它允许您将文件保存到用户的本地计算机。该对话框仅打开,允许您保存文件。我正在寻找一种打开文件的方法,类似于通过浏览器下载文件时出现的对话框。
除了将文件往返到服务器或让服务器生成文件(我都不能这样做)之外,还有其他选项可以执行此操作吗?
In Silverlight, there is the SaveFileDialog which allows you to save a file to the user's local machine. The dialog opens only allowing you to save the file. What I'm looking for is a way to open the file similar to the dialog you get when downloading a file through the browser.
Aside from round-tripping the file to a server, or having the server generate the file (neither of which I can do), are there any options to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的答案是:没有 silverlight 不允许这样做。
如果您以某种方式知道要打开的文件的完整文件路径,您可能能够让托管浏览器导航到该文件,但您可能会遇到其他基于浏览器的障碍。当然,在这种情况下,发现文件的完整文件路径实际上是不可能的。您必须让用户将完整路径粘贴到某个文本框中,然后尝试说服浏览器导航到它。
The simple answer is: No silverlight doesn't allow that.
If somehow you know that full file path of the file you want to open you might be able to get the hosting browser to navigate to that file but you may hit other browser based road blocks. Of course, discovering the full file path of a file is pratically impossible to do in this scenario. You'd have to get the user to paste the full path into some text box then try to convince the browser to navigate to it.