As with directories, it is also possible to iterate through the files located in a given folder. You will learn how to do this in this recipe.
As an example, the project from the previous recipe will be modified by adding an Iterate through files button. Once you click on it, a list of filenames from the Book
directory will be presented in the text block.
To create an example that gets a list of files from a given directory, as well as iterate through them, perform the following steps:
Add the Iterate through files button to the page by modifying the content of the
MainPage.xaml
file as follows:<Page (...)> <StackPanel> (...) <Button Content="Iterate through files" HorizontalAlignment="Center" VerticalAlignment="Center" Click="BtnIterateFiles_Click...