I used information from here http://msdn.microsoft.com/ru-ru/library/system.windows.forms.openfiledialog(v=vs.110).aspx
this way:
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.DefaultExt = ".xml"; // this is how I get only required extension
dlg.Filter = "XML files (*.xml)|*.xml"; // I guess, this should be modified, don't know how.
dlg.InitialDirectory = _directoryName1;
// here we go
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
string path = dlg.FileName;
In the Initial Directory I have to types of files of same xml extension, which names begin with script-Data... or GeneralParam.... So I need to show in the OpenFileDialog only files, which names begin with script-Data....
I know, that I can notify user, what he has decided wrong file by parsing path, but it isn't good solution for me. Is any other way out here?