Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/22/11 17:25:52 (13 years ago)
Author:
mkommend
Message:

#1564: Corrected cloning bug in drop method of collection views.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r5839 r6472  
    2626using System.Windows.Forms;
    2727using HeuristicLab.Collections;
     28using HeuristicLab.Common;
    2829using HeuristicLab.MainForm;
    2930using HeuristicLab.MainForm.WindowsForms;
     
    294295        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
    295296          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
     297          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
     298            Cloner cloner = new Cloner();
     299            items = items.Select(i => (T)i.Clone(cloner));
     300          }
    296301          foreach (T item in items)
    297             Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
     302            Content.Add(item);
    298303        }
    299304      }
Note: See TracChangeset for help on using the changeset viewer.