當前位置: 首頁>>代碼示例>>C#>>正文


C# Xaml.DragEventArgs類代碼示例

本文整理匯總了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;
 }
開發者ID:n01d,項目名稱:w10demoking,代碼行數:7,代碼來源:DropPage.xaml.cs

示例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);
            }
        }
開發者ID:NestedWorld,項目名稱:Windows10,代碼行數:29,代碼來源:UserMonsterListView.xaml.cs

示例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);
        }
開發者ID:nathanashton,項目名稱:BookieUWP,代碼行數:29,代碼來源:BooksGrid.xaml.cs

示例4: Image_DragOver

 private void Image_DragOver(object sender, DragEventArgs e)
 {
     if (DataContext is ViewModels.TodoItemViewModel)
     {
         e.AcceptedOperation = DataPackageOperation.Copy;
     }
 }
開發者ID:Ronacs,項目名稱:WinDevCamp,代碼行數:7,代碼來源:ToDoItemFullViewUserControl.xaml.cs

示例5: ListView_DragOver

		private void ListView_DragOver(object sender, DragEventArgs e)
		{
			if (e.DataView.Contains(StandardDataFormats.Text))
			{
				e.AcceptedOperation = DataPackageOperation.Move;
			}
		}
開發者ID:muneneevans,項目名稱:blog,代碼行數:7,代碼來源:MainPage.xaml.cs

示例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;
 }
開發者ID:acedened,項目名稱:TheChan,代碼行數:8,代碼來源:ExtendedPostingView.xaml.cs

示例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     
 }
開發者ID:nicol3ta,項目名稱:ink-demo,代碼行數:13,代碼來源:MainPage.xaml.cs

示例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; 
 }
開發者ID:myCodePixel,項目名稱:blogsamples,代碼行數:10,代碼來源:MainPage.xaml.cs

示例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);

            }
        }
開發者ID:acedened,項目名稱:TheChan,代碼行數:10,代碼來源:ExtendedPostingView.xaml.cs

示例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);
        }
開發者ID:NathanTeeuwen,項目名稱:Dominulator,代碼行數:11,代碼來源:Strategy.xaml.cs

示例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;
        }
開發者ID:jamesmcroft,項目名稱:DragDrop-UWP-Sample,代碼行數:12,代碼來源:MainPage.xaml.cs

示例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();
         }
     }
 }
開發者ID:JuniperPhoton,項目名稱:IconCreatorForUWP,代碼行數:13,代碼來源:MainPage.xaml.cs

示例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);
		}
開發者ID:MicrosoftDXGermany,項目名稱:Sport,代碼行數:13,代碼來源:LineupEditPage.xaml.cs

示例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;
        }
開發者ID:Ephemerial,項目名稱:Awful-Forums-Reader,代碼行數:13,代碼來源:NewThreadPage.xaml.cs

示例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;
         }
     }
 }
開發者ID:Shpak1,項目名稱:Work,代碼行數:14,代碼來源:WorkSpace.xaml.cs


注:本文中的Windows.UI.Xaml.DragEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。