FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { // Process selected file }
FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.List; openPicker.CommitButtonText = "Use this file"; openPicker.FileTypeFilter.Add("*"); IReadOnlyListThis example creates a FileOpenPicker instance that allows the user to select multiple files of any type. The commit button text is also customized. The selected files are returned as a read-only list of StorageFile objects that can be processed as needed. The package/library for this class is part of the Windows Runtime API and does not require any external packages or libraries.files = await openPicker.PickMultipleFilesAsync(); if (files.Count > 0) { // Process selected files }