Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly specify FileOpenpicker.FileTypeFilter syntax for UWP

Is there a way to specify the filter like in OpenFileDialog, e.g.

openFileDialog.Filter = "Text Files (.txt)|*.txt|All Files (*.*)|*.*"

FileOpenpicker.FileTypeFilter.Add doesn't seem to accept the same syntax. MSDN is a poor source of information in these regards and does not provide examples for vb.net

like image 683
Alessandro Mandelli Avatar asked Aug 25 '15 10:08

Alessandro Mandelli


1 Answers

You probably got it by now, but in any case this is the way to do it (C#):

    openPicker.FileTypeFilter.Add(".xxx");
    openPicker.FileTypeFilter.Add(".yyy");
    openPicker.FileTypeFilter.Add("*");

This will show 3 items on the list (.xxx), (.yyy) and "All files (*)".

like image 85
CFreitas Avatar answered Nov 11 '22 06:11

CFreitas