ideaki's blog

WinRT C#/XAML の開発について

UWP エクスプローラからのドラッグ&ドロップ

channel9.msdn.com
ユーザーは待っていたドラッグアンドドロップ

したサンプル

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AllowDrop="True" DragOver="Grid_DragOver"Drop="Grid_Drop">
    <TextBlock x:Name="AATextBlock" FontFamily="MS PGothic" Text="Drag &amp; Drop Text File"  VerticalAlignment="Center" HorizontalAlignment="Center"/>
    <FontIcon/>
private void Grid_DragOver(object sender, DragEventArgs e)
{
    e.AcceptedOperation = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Copy;
    e.Handled = true;
}

private async void Grid_Drop(object sender, DragEventArgs e)
{
    var d = e.GetDeferral();

    var files = await e.DataView.GetStorageItemsAsync();
    var file = files.First();

    this.AATextBlock.Text = await FileIO.ReadTextAsync(file as IStorageFile);

    d.Complete();
}