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

Creating a file

Different kinds of data may be stored in files. Thus, it is crucial to learn how to create an empty file that can be later filled with content. You will learn how to create a file in a given folder in this recipe.

As an example, you will modify the project from the previous recipe by adding a Create files button. After pressing it, a set of files will be created.

Getting ready

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

How to do it...

To prepare an example that creates files, perform the following steps:

  1. Add the Create files button to the page by modifying the content of the MainPage.xaml file as follows:
            <Page (...)> 
                <StackPanel> (...) 
                    <Button Content="Create files" HorizontalAlignment="Center" VerticalAlignment="Center" ...

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