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

Iterating through files

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.

Getting ready

To step through this recipe, you need a project from the previous recipe.

How to do it...

To create an example that gets a list of files from a given directory, as well as iterate through them, perform the following steps:

  1. Add the Iterate through files button to the page by modifying the content of the MainPage.xaml file as follows:
     <Page (...)> <StackPanel> (...) ...

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