void PasteRows(GridViewBase view, BindingList <CopyPasteOutlookData> list)
 {
     if (view != null)
     {
         ArrayList   arrayList = null;
         IDataObject dataObj   = GetClipboardDataObject();
         string      format    = typeof(ArrayList).FullName;
         if (dataObj != null && dataObj.GetDataPresent(format))
         {
             positionsNewRowsList.Clear();
             pasteWithoutAnimation = null;
             animation             = true;
             StartPasteForCanCommands();
             arrayList = dataObj.GetData(format) as ArrayList;
             object[] objectsForCopy = arrayList.ToArray();
             int      positionNewRow = view.FocusedRowHandle == DataControlBase.InvalidRowHandle ? 0 : view.Grid.GetListIndexByRowHandle(view.FocusedRowHandle) + 1;
             if (maxAnimationRows > objectsForCopy.Length)
             {
                 PasteRowsWithAnimation(ref positionNewRow, view, list, objectsForCopy, 0, objectsForCopy.Length);
             }
             else
             {
                 PasteRowsWithAnimation(ref positionNewRow, view, list, objectsForCopy, 0, maxAnimationRows);
             }
             pastingGrid = FocusedGrid;
             Dispatcher.BeginInvoke(new System.Action(AnimationRowsOfPasted), DispatcherPriority.Background);
         }
     }
     else
     {
         textEdit.Paste();
     }
 }
        void PasteRowsWithAnimation(ref int positionNewRow, GridViewBase view, BindingList <CopyPasteOutlookData> list, object[] objectsForCopy, int start, int end)
        {
            bool insertToEndOfRows = view.FocusedRowHandle == GridControl.InvalidRowHandle;

            for (int i = start; i < end; i++)
            {
                CopyPasteOutlookData obj = ((CopyPasteOutlookData)objectsForCopy[i]);
                obj.UniqueID = ++Counter;
                if (i == maxAnimationRows - 1)
                {
                    pasteWithoutAnimation = new PasteHelper()
                    {
                        List = list, ObjectsForCopy = objectsForCopy, Owner = this, PositionNewRow = positionNewRow, View = view
                    };
                }
                if (PastUnderFocusedRow && (list.Count != 0) && !insertToEndOfRows)
                {
                    list.Insert(positionNewRow, obj);
                    positionsNewRowsList.Add(positionNewRow);
                    positionNewRow++;
                }
                else
                {
                    list.Add(obj);
                    positionsNewRowsList.Add(list.Count - 1);
                }
            }
        }
        void StartAnimation(int positionNewRow, PasteHelper pasteWithoutAnimation)
        {
            Storyboard addingStoryboard = GetStoryboard("newRowStoryboard");
            Storyboard colorStoryboard  = GetStoryboard("newRowColorStoryboard");

            if (pasteWithoutAnimation != null)
            {
                pasteWithoutAnimation.ColorStoryboard = colorStoryboard;
                colorStoryboard.Completed            += new EventHandler(pasteWithoutAnimation.ColorStoryboardCompleted);
            }
            if (positionsNewRowsList[positionsNewRowsList.Count - 1] == positionNewRow)
            {
                PasteCompetedHelper pasteHelper = new PasteCompetedHelper()
                {
                    Owner = this, ColorStoryboard = colorStoryboard
                };
                colorStoryboard.Completed += new EventHandler(pasteHelper.ColorStoryboardCompleted);
            }
            StartStoryboard(addingStoryboard, positionNewRow, RowsAnimationElement.NewRowsProgressProperty);
            StartStoryboard(colorStoryboard, positionNewRow, RowsAnimationElement.NewRowsColorProperty);
        }