Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个 SLDocument,其中保存了从 XML 获得的内容,但我希望用户将其保存在用户想要的位置,我已经看到 SLDocument 只有 SaveAs 选项,我必须指定路线,所以我不知道如何使“保存”对话框显示,有人可以帮我吗?
您可以使用内置的 Windows 对话框,使用如下内容:
var dialog = new Microsoft.Win32.SaveFileDialog { FileName = "defaultfilename.jpg", DefaultExt = ".jpg", }; bool? result = dialog.ShowDialog(); // true if the user saved, false if they cancelled string filepath = dialog.FileName;