本文整理匯總了C#中Windows.UI.Xaml.DragEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# DragEventArgs類的具體用法?C# DragEventArgs怎麽用?C# DragEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DragEventArgs類屬於Windows.UI.Xaml命名空間,在下文中一共展示了DragEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnDropped
private async void OnDropped(object sender, DragEventArgs e)
{
var file = (StorageFile)(await e.DataView.GetStorageItemsAsync())[0];
var imageSource = new BitmapImage();
imageSource.SetSource(await file.OpenReadAsync());
myImg.Source = imageSource;
}
示例2: TargetListView_Drop
private async void TargetListView_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
var def = e.GetDeferral();
var s = await e.DataView.GetTextAsync();
string[] items = s.Split('\n');
View.MonsterSoloView msv = new MonsterSoloView();
msv.DataContext = monsterList.GetMonsterByID(Convert.ToInt32(items[0]));
SelectedMonsterList.Add(monsterList.GetMonsterByID(Convert.ToInt32(items[0])));
msv.SetValue(Grid.HorizontalAlignmentProperty, HorizontalAlignment.Center);
msv.SetValue(Grid.VerticalAlignmentProperty, VerticalAlignment.Center);
Grid grid = sender as Grid;
foreach (var element in grid.Children)
{
View.MonsterSoloView msvelement = element as View.MonsterSoloView;
SelectedMonsterList.monsterList.Remove(msvelement.DataContext as Monster);
grid.Children.Remove(element);
}
grid.Children.Add(msv);
e.AcceptedOperation = DataPackageOperation.Copy;
def.Complete();
selectedMonsterGridView.DataContext = new ObservableCollection<Monster>(SelectedMonsterList.monsterList);
}
}
示例3: gview_Drop
private void gview_Drop(object sender, DragEventArgs e)
{
viewmodel.BooksScroll = ScrollMode.Enabled;
object gridSource;
e.Data.Properties.TryGetValue("gridSource", out gridSource);
if (gridSource == sender)
return;
object sourceItem;
e.Data.Properties.TryGetValue("item", out sourceItem);
if (sourceItem == null)
return;
// viewmodel.ShelfBrush = _shelfBrushColor;
// viewmodel.GridBrush = _gridBrushColor;
//Remove it from shelf
var book = (Book)sourceItem;
viewmodel.ShelfBooks.Remove(book);
book.Shelf = false;
var a = new BookEventArgs();
a.Book = book;
a.State = BookEventArgs.BookState.Updated;
viewmodel.BookChanged(this, a);
viewmodel.UpdateBook(book);
}
示例4: Image_DragOver
private void Image_DragOver(object sender, DragEventArgs e)
{
if (DataContext is ViewModels.TodoItemViewModel)
{
e.AcceptedOperation = DataPackageOperation.Copy;
}
}
示例5: ListView_DragOver
private void ListView_DragOver(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
e.AcceptedOperation = DataPackageOperation.Move;
}
}
示例6: ExtendedPostingView_OnDragOver
private void ExtendedPostingView_OnDragOver(object sender, DragEventArgs e) {
e.AcceptedOperation = DataPackageOperation.Copy;
if (e.DragUIOverride == null)
return;
e.DragUIOverride.IsCaptionVisible = true;
e.DragUIOverride.IsContentVisible = true;
e.DragUIOverride.IsGlyphVisible = true;
}
示例7: Grid_DragOver
/// <summary>
/// Handle DragOver event, which fires when a user has dragged an item over the app, but not yet dropped it.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Grid_DragOver(object sender, DragEventArgs e)
{
e.AcceptedOperation = DataPackageOperation.Copy;
//Customize the UI
e.DragUIOverride.Caption = "Copy picture here"; // Sets custom UI text
e.DragUIOverride.IsCaptionVisible = true; // Sets if the caption is visible
e.DragUIOverride.IsContentVisible = true; // Sets if the dragged content is visible
}
示例8: Grid_DragOver
private void Grid_DragOver(object sender, DragEventArgs e)
{
e.AcceptedOperation = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Copy;
e.AcceptedOperation = DataPackageOperation.Copy;
e.DragUIOverride.Caption = "Copy";
e.DragUIOverride.IsCaptionVisible = true;
e.DragUIOverride.IsContentVisible = true;
e.DragUIOverride.IsGlyphVisible = true;
}
示例9: ExtendedPostingView_OnDrop
private async void ExtendedPostingView_OnDrop(object sender, DragEventArgs e) {
if (!e.DataView.Contains(StandardDataFormats.StorageItems))
return;
var items = await e.DataView.GetStorageItemsAsync();
foreach (IStorageFile file in items.OfType<IStorageFile>()) {
await ViewModel.Attach(file);
}
}
示例10: CurrentCardsListView_Drop
private async void CurrentCardsListView_Drop(object sender, DragEventArgs e)
{
if (!e.Data.GetView().AvailableFormats.Contains("text"))
return;
string cardNames = (string)await e.Data.GetView().GetTextAsync("text");
Dominion.Card[] cards = cardNames.Split(',').Select(cardName => DominionCard.Create(cardName).dominionCard).ToArray();
Dominion.Strategy.Description.StrategyDescription strategy = this.StrategyDescription.ConvertToDominionStrategy();
strategy = strategy.AddCardsToPurchaseOrder(cards);
this.StrategyDescription.PopulateFrom(strategy);
}
示例11: OnFileDragOver
private void OnFileDragOver(object sender, DragEventArgs e)
{
e.AcceptedOperation = DataPackageOperation.Copy;
if (e.DragUIOverride != null)
{
e.DragUIOverride.Caption = "Add file";
e.DragUIOverride.IsContentVisible = true;
}
this.AddFilePanel.Visibility = Visibility.Visible;
}
示例12: ImageGrid_Drop
private async void ImageGrid_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
var items = await e.DataView.GetStorageItemsAsync();
if (items.Count > 0)
{
var storageFile = items[0] as StorageFile;
_oriFile = storageFile;
await ShowImage();
}
}
}
示例13: Canvas_Drop
private async void Canvas_Drop(object sender, DragEventArgs e)
{
DataTemplate dataTemplate = this.Resources["PlayerElementTemplate"] as DataTemplate;
var elem = dataTemplate.LoadContent() as FrameworkElement;
var pname = await e.DataView.GetTextAsync();
elem.DataContext = App.MainViewModel.SelectedTeam.Players.First((pl) => pl.Name == pname);
var p = e.GetPosition(Canvas);
Canvas.SetLeft(elem, p.X);
Canvas.SetTop(elem, p.Y);
Canvas.Children.Add(elem);
}
示例14: Grid_OnDrop
private async void Grid_OnDrop(object sender, DragEventArgs e)
{
Locator.ViewModels.NewThreadVm.IsLoading = true;
var d = e.GetDeferral();
var files = await e.DataView.GetStorageItemsAsync();
foreach (var file in files)
{
await Locator.ViewModels.NewThreadVm.ImgurAddImageCommand.AddImgurImage(file as StorageFile, ReplyText);
}
d.Complete();
Locator.ViewModels.NewThreadVm.IsLoading = false;
}
示例15: Grid_Drop
private async void Grid_Drop(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
var items = await e.DataView.GetStorageItemsAsync();
if (items.Count > 0)
{
var storageFile = items[0] as StorageFile;
var bitmapImage = new BitmapImage();
bitmapImage.SetSource(await storageFile.OpenAsync(FileAccessMode.Read));
Collage.Source = bitmapImage;
}
}
}