Just like a folder, a file can also be removed using the DeleteAsync
method.
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 see how to remove a given file, perform the following steps:
Add the Delete a file button to the page by modifying the content of the
MainPage.xaml
file as follows:<Page (...)> <StackPanel> (...) <Button Content="Delete a file" HorizontalAlignment="Center" VerticalAlignment="Center" Click="BtnDeleteFile_Click" /> <TextBlock x:Name="TxtResult" TextWrapping="Wrap" /> </StackPanel> </Page...