Alessandro Mandelli
Alessandro Mandelli

Reputation: 581

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

Upvotes: 8

Views: 2058

Answers (1)

CFreitas
CFreitas

Reputation: 1775

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 (*)".

Upvotes: 3

Related Questions