积极答复者
FileSavePicker如何指定筛选器?(C++)

问题
答案
-
我用的这个办法:
auto plainTextExtensions = ref new Platform::Collections::Vector<String^>(); plainTextExtensions->Append(".txt"); picker->FileTypeChoices->Insert("PlainText", plainTextExtensions);
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 lxylxy123456 2014年5月16日 9:12
全部回复
-
其中主要是如何定义筛选器,我的代码是:
auto Picker = ref new Windows::Storage::Pickers::FileSavePicker(); Picker->FileTypeChoices->Insert();//这句代码怎么写? create_task(Picker->PickSaveFileAsync()).then([this](Windows::Storage::StorageFile^ file){ //省略 });
- 已编辑 lxylxy123456 2014年5月16日 4:08
-
首先,FileOpenPicker是用来打开文件,FileSavePicker是用来保存文件。
那么我就当你问的是FileOpenPicker(其实FileSavePicker原理是一样的),
auto picker = ref new FileOpenPicker(); picker->ViewMode = PickerViewMode::List; picker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary; picker->FileTypeFilter->Append(".txt"); picker->FileTypeFilter->Append(".jpg"); task<StorageFile^> m_pickFileTask(picker->PickSingleFileAsync()); m_pickFileTask.then([this](StorageFile^ file) { //do something here. String^ fileName = file->DisplayName->ToString(); });
--James<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later. -
我用的这个办法:
auto plainTextExtensions = ref new Platform::Collections::Vector<String^>(); plainTextExtensions->Append(".txt"); picker->FileTypeChoices->Insert("PlainText", plainTextExtensions);
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 lxylxy123456 2014年5月16日 9:12