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

438 Views Asked by At

I have created a SLDocument, in which I have saved what I have obtained from an XML, but I want the user to save it in the location user wants, I have seen that the SLDocument only has the SaveAs option and I must specify the route, so I do not know how I can make the "save in" dialog show, can someone help me please?

1

There are 1 best solutions below

5
On

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;