вторник, 6 апреля 2010 г.

How to use a Save File Dialog in WPF?

The SaveFileDialog class defined in Microsoft.Win32 namespace represents Windows Save File Dialog control.


The following code snippet creates a SaveFileDialog, sets its default extension and fiter properties and calls ShowDialog method that displays SaveFileDialog control.



Microsoft.Win32.
SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.DefaultExt = 
".txt";
dlg.Filter = 
"Text documents (.txt)|*.txt"if (dlg.ShowDialog() == true )
   string filename = dlg.FileName;
}

Комментариев нет: