I want to create a Save As screen as it is in Windows. How can I do that in a WPF application?
+1
A:
Microsoft.Win32.SaveFileDialog is what you need. Here's the code snippet from MSDN;
// Configure save file dialog box
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 by 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;
}
Samuel Jack
2010-06-25 08:30:00
Thanks Jack.. can you also give some idea for print screen,print priview screen.
ashish semwal
2010-06-25 08:35:51
@ashish semwal: Always lookup the `System.Windows.Controls` namespace for wpf controls. http://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog.aspx
Veer
2010-06-25 08:49:37
thanks a lot ...!!:-))
ashish semwal
2010-08-12 14:14:24