c# - How do I show a Save As dialog in WPF? -
i have requirement in wpf/c# click on button, gather data , put in text file user can download machine. can first half of this, how prompt user "save as" dialog box? file simple text file.
both answers far link silverlight savefiledialogclass; wpf variant quite bit different , differing namespace.
microsoft.win32.savefiledialog dlg = new microsoft.win32.savefiledialog(); dlg.filename = "document"; // default file name dlg.defaultext = ".text"; // default file extension dlg.filter = "text documents (.txt)|*.txt"; // filter files extension // show save file dialog box nullable<bool> result = dlg.showdialog(); // process save file dialog box results if (result == true) { // save document string filename = dlg.filename; }
Comments
Post a Comment