Daily Archives: June 17, 2013

Using any file type in the file save picker

In Windows 8 you can easily configure the File Open Picker to allow the user to select a file with any type – just use the well-known asterisk:

var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.fileTypeFilter.replaceAll(["*"]);

You can try the same with the File Save Picker as well:

var savePicker = new Windows.Storage.Pickers.FileSavePicker();
savePicker.fileTypeChoices.insert("Any", ["*"]);

However, this raises a runtime error:

0x80070057 – JavaScript runtime error: The parameter is incorrect.

WinRT information: This file picker does not allow the all files extension.

Fortunately there is a nice hack to force the File Save Picker to allow any file type:

savePicker.fileTypeChoices.insert("Any", ["."]);

Technorati-címkék: ,,,