tags:

views:

33

answers:

1

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
Thanks Jack.. can you also give some idea for print screen,print priview screen.
ashish semwal
@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
thanks a lot ...!!:-))
ashish semwal