简体   繁体   中英

How to show the “save in” dialog for a sldocument in c #?

我创建了一个SLDocument,其中保存了从XML中获取的内容,但是我希望用户将其保存在用户想要的位置,我已经看到SLDocument仅具有SaveAs选项,并且必须指定路由,所以我不知道如何显示“保存于”对话框,有人可以帮我吗?

You can use the built-in Windows dialog, using something like this:

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM