Bimo
Bimo

Reputation: 6665

UWP: Button to Launch Windows Explorer with Folder set to the "App's Local Data Folder"

Is it possible in UWP to launch file explorer with the current app's "local data folder"?

First I'm wondering how to invoke Explore or similar File Exploring Apps from UWP application.

Second, I'm wondering how to set the directory of the file explorer to the Current App's Local Data Folder. My goal is to have a Button.Click event handler invoke it.

Upvotes: 0

Views: 1006

Answers (2)

Bimo
Bimo

Reputation: 6665

Based on Martin Zikmund's Answer:

...
using Windows.System;
using Windows.Storage;

namespace MyProject
{
    public sealed partial class BlankPage2 : Page
    {
        ...

        async private void Button_Click(object sender, RoutedEventArgs e)
        {
            await Launcher.LaunchFolderAsync
                       (ApplicationData.Current.LocalFolder);
        }
    }
}

Upvotes: 1

Martin Zikmund
Martin Zikmund

Reputation: 39112

Yes, you can use Launcher's LaunchFolderAsync method:

await Launcher.LaunchFolderAsync(ApplicationData.Current.LocalFolder);

Upvotes: 7

Related Questions