UWP エクスプローラからのドラッグ&ドロップ
channel9.msdn.com
ユーザーは待っていたドラッグアンドドロップ
UWP App ファイルエクスプローラからのドラックアンドドロップアンドオープン https://t.co/dNrOyZhmEm
— くコ:彡@衰退期 (@ideaki19) 2015, 5月 3
したサンプル
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AllowDrop="True" DragOver="Grid_DragOver"Drop="Grid_Drop"> <TextBlock x:Name="AATextBlock" FontFamily="MS PGothic" Text="Drag & 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(); }