private void OnItemsChanging(object sender, DiagramItemsChangingEventArgs e)
        {
            //if (this.isClear) return;

            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
            {
                var rowModel = e.OldItems.ElementAt(0) as RowModel;
                var command  = new CompositeCommand("Remove Connections");
                if (rowModel != null)
                {
                    this.RemoveRowModel(rowModel, command);
                    if (command.Commands.Count() > 0)
                    {
                        this.tlrDiagram.UndoRedoService.ExecuteCommand(command);
                    }
                }
                else
                {
                    var tableModel = e.OldItems.ElementAt(0) as TableModel;
                    if (tableModel != null)
                    {
                        foreach (var item in tableModel.InternalItems)
                        {
                            this.RemoveRowModel(item as RowModel, command);
                        }
                        if (command.Commands.Count() > 0)
                        {
                            this.tlrDiagram.UndoRedoService.ExecuteCommand(command);
                        }

                        tableModel.InternalItems.Clear();
                    }
                }
            }
        }
        private void OnItemsChanging(object sender, DiagramItemsChangingEventArgs e)
        {
            if (this.isClear) return;

            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
            {
                var rowModel = e.OldItems.ElementAt(0) as RowModel;
                var command = new CompositeCommand("Remove Connections");
                if (rowModel != null)
                {
                    this.RemoveRowModel(rowModel, command);
                    if (command.Commands.Count() > 0)
                        this.diagram.UndoRedoService.ExecuteCommand(command);
                }
                else
                {
                    var tableModel = e.OldItems.ElementAt(0) as TableModel;
                    if (tableModel != null)
                    {
                        foreach (var item in tableModel.InternalItems)
                        {
                            this.RemoveRowModel(item as RowModel, command);
                        }
                        if (command.Commands.Count() > 0)
                            this.diagram.UndoRedoService.ExecuteCommand(command);

                        tableModel.InternalItems.Clear();
                    }
                }
            }
        }
 private void OnSwimlaneDiagramItemsChanging(object sender, DiagramItemsChangingEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         var container = e.OldItems.ElementAt(0) as SwimlaneShapeBase;
         if (container != null && container.ParentMainContainer != null)
         {
             foreach (var item in container.ParentMainContainer.OrderedChildren.Where(c => c.ContainerPosition > container.ContainerPosition))
             {
                 item.ContainerPosition--;
             }
         }
     }
 }