public void OnItemsPasted(List <object> itemsToPaste, List <object> metaData, Point pastePoint, WorkflowViewElement pastePointReference) { // first see if a spacer is selected. int index = this.selectedSpacerIndex; // else see if we can paste after a selected child if (index < 0) { Selection currentSelection = this.Context.Items.GetValue <Selection>(); index = this.Items.IndexOf(currentSelection.PrimarySelection); //paste after the selected child if (index >= 0) { index++; } } if (index < 0) { index = addAtEndMarker; } IList <object> mergedItemsToPaste = CutCopyPasteHelper.SortFromMetaData(itemsToPaste, metaData); List <ModelItem> modelItemsToSelect = new List <ModelItem>(); foreach (object itemToPaste in mergedItemsToPaste) { if (IsDropAllowed(itemToPaste)) { if (index == addAtEndMarker) { modelItemsToSelect.Add(this.Items.Add(itemToPaste)); } else { modelItemsToSelect.Add(this.Items.Insert(index, itemToPaste)); } if (index >= 0) { index++; } } } this.Dispatcher.BeginInvoke( new Action(() => { this.Context.Items.SetValue(new Selection(modelItemsToSelect)); }), Windows.Threading.DispatcherPriority.ApplicationIdle, null); }
void ICompositeView.OnItemsPasted(List <object> itemsToPaste, List <object> metaData, Point pastePoint, WorkflowViewElement pastePointReference) { if (itemsToPaste.Count == 1) { // Single Paste UpdateItem(itemsToPaste[0]); } else { // Mutiple Paste. IList <object> sortedList = CutCopyPasteHelper.SortFromMetaData(itemsToPaste, metaData); Fx.Assert(this.Item == null, "multi-paste on item != null is not supported now"); this.DoAutoWrapDrop(InsertionPosition.None, sortedList); } }