O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Choosing a file to open

In the previous examples, you have used files whose paths are defined directly in the code, either XAML or C#. However, sometimes it may be necessary to provide a user with the option of choosing a file to open. Of course, the suitable mechanism is available for UWP applications, as you will see in this recipe.

As an example, you will create a page with the Choose a file button. After clicking on it, the file picker will be presented, where a user can choose a particular file, restricting the options to .jpg files. When the operation is confirmed, the image is loaded and presented in the user interface.

Getting ready

To step through this recipe, you only need the automatically generated project.

How to do it...

To prepare an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required