-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Windows Application Development Cookbook
By :
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.
To step through this recipe, you only need the automatically generated project.
To prepare an example that allows to present an image chosen by the user, perform the following steps:
Image control (where the chosen photo will be shown) and the button to the page by adjusting the content of the MainPage.xaml file, as follows:...