Just like a folder, a file can also be removed using the
As an example, you will modify the project from the previous recipe by adding a Delete a file button. Once you press it, the
Notes.txt file from the
Book directory will be deleted.
To step through this recipe, you need the project from the previous recipe.
To see how to remove a given file, perform the following steps:
MainPage.xamlfile as follows:
<Page (...)> <StackPanel> (...) <Button Content="Delete a file" HorizontalAlignment="Center" VerticalAlignment="Center" Click="BtnDeleteFile_Click" /> <TextBlock x:Name="TxtResult" TextWrapping="Wrap" /> </StackPanel> ...