File Picker

The file picker has two modes, exposed as two different classes in the Windows.Storage.Pickers namespace: FileOpenPicker and FileSavePicker. You see the FileOpenPicker used in Chapter 12, “Images,” as follows:

// Get a JPEG from the user FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); StorageFile file = await picker.PickSingleFileAsync();

However, this code is PC-specific. Currently, you must use a different API when running on a phone: PickSingleFileAndContinue. This API synchronously returns (with a void return type), but it causes your app to be suspended while the phone’s file picker is shown. In low-memory conditions, your app might ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.