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

Reading a text file

Apart from writing plain text to a file, it is also possible to read its content. In this recipe, you will learn how to do it.

As an example, you will modify the project from the previous recipe to support the operation of reading content of a text file. This modification requires you to add a Load button. Once you click on it, the loaded content will be shown in the textbox.

Getting ready

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

How to do it...

To prepare an example that reads notes from a text file, perform the following steps:

  1. Adjust the design of the page by modifying the content of the MainPage.xaml file, as shown in the following code snippet:
     <Page (...)> <Grid Padding="20"> <Grid.RowDefinitions> ...

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