예제 #1
0
 private void lvButtons_TextBlock_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("WPFDragDrop.Model.ItemModel"))
     {
         var           data     = e.Data.GetData("WPFDragDrop.Model.ItemModel");
         var           itemData = (ItemModel)data;
         CategoryModel category = (CategoryModel)(((TextBlock)sender).DataContext);
         //If same category and have not been added already, show Copy, otherwise show "block".
         if (category.MatchesAll || category.Matches.Contains(itemData.GroupName))
         {
             category.Drop(itemData);
             e.Handled = true;
             this.BottomHoverText.Text = "";
             dragSource = null;
         }
         else
         {
             e.Effects  = DragDropEffects.None;
             e.Handled  = true;
             dragSource = null;
         }
     }
 }