private async void Grid_Drop(object sender, DragEventArgs e) { //如果有文字,那么就是把他放在要拖放的TextBlock bool hasText = e.DataView.Contains(StandardDataFormats.Text); //显示复制还是没有 //拖动显示可以去我之前写的 http://blog.csdn.net/lindexi_gd/article/details/49757187?locationNum=2&fps=1 e.AcceptedOperation = hasText ? DataPackageOperation.Copy : DataPackageOperation.None; if (hasText) { var text = await e.DataView.GetTextAsync(); if (AppViewModel.IsInCompactOverlayMode) { CompactOverlay_HomePage.Current.AutoSuggestBox.Text = text; CompactOverlay_HomePageViewModel.Current.CompactOverlay_QueryWord(text); } else { HomePage.Current.AutoSuggestBox.Text = text; HomePageViewModel.Current.QueryWord(text); } } DragGridClose.Begin(); }
private void Grid_DragLeave(object sender, DragEventArgs e) { DragGridClose.Begin(); }