Silverlight SaveFileDialog.SelectedFile?
我正在 Silverlight 中处理异常处理对话框。当抛出异常时,会弹出一个对话框,其中包含有关错误的详细信息,以及一个允许用户保存错误日志并将其发送给开发人员的按钮。当用户单击保存错误日志
按钮时,会弹出一个SaveFileDialog
并让用户浏览到他想要保存文件的位置。
如何获取所选文件的完整路径(例如C:\Folder\logfile.log
)? SafeFileName
属性仅提供文件名(例如logfile.log
)。
I'm working in Silverlight on an Exception handling dialog. When an exception is thrown, the dialog pops up with details about the error, and a button that allows the user to save the error log and send it to the developer. When the user clicks the Save Error Log
button, a SaveFileDialog
pops up and lets the user browse to where (s)he wants to save the file.
How do I get the full path (e.g. C:\Folder\logfile.log
) of the selected file? The SafeFileName
property only gives me the file name (e.g. logfile.log
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于处于沙盒状态,您无法获取 SL 应用程序内的完整路径。不过,您可以在 WPF 中执行此操作,因为此时您拥有完全访问权限。
但这并不意味着您无法通过公开的 Stream 将文件保存到给定位置。完整示例此处。
You can't get the full path within an SL application due to being sandboxed. You could do this however within WPF since you have full access at that point.
That does not mean you can not save the file to the given location via the exposed
Stream
though. Complete example here.