Apart from creating and renaming a directory, it is also possible to programmatically delete it. You will learn how to do this in the current recipe.
As an example, you will modify the project from the previous recipe by adding a Delete a directory button. Once you click on it, the Book
folder should be removed.
To see how to remove a given directory, perform the following steps:
Add the Delete a directory button to the page by modifying the content of the
MainPage.xaml
file as follows:<Page (...)> <StackPanel> (...) <Button Content="Delete a directory" HorizontalAlignment="Center" VerticalAlignment="Center" Click="BtnDeleteDirectory_Click" /> <TextBlock x:Name="TxtResult" ...