Exemple #1
0
        private void AssociatedObject_MouseLeave(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                IBImage trg = AssociatedObject.DataContext as IBImage;
                if (trg == null || trg.owner == null)
                {
                    return;
                }

                CellSource trgOwner = trg.owner as CellSource;
                if (trgOwner == null)
                {
                    return;
                }

                LayerDragData data = new LayerDragData()
                {
                    from      = trg,
                    fromOwner = trgOwner,
                    fromIndex = trgOwner.Layers.IndexOf(trg)
                };

                DragDrop.DoDragDrop(AssociatedObject, data, DragDropEffects.Move);
            }
        }
Exemple #2
0
        private void AssociatedObject_DragEnter(object sender, DragEventArgs e)
        {
            LayerDragData data = e.Data.GetData(typeof(LayerDragData)) as LayerDragData;

            if (data != null)
            {
                IBImage trg = AssociatedObject.DataContext as IBImage;
                if (trg == null || trg == data.from || trg.owner == null)
                {
                    return;
                }

                CellSource trgOwner = trg.owner as CellSource;
                if (trgOwner == null || trgOwner != data.fromOwner)
                {
                    return;
                }

                int trgIndex = trgOwner.Layers.IndexOf(trg);

                trgOwner.Layers.Remove(data.from);
                trgOwner.Layers.Insert(trgIndex, data.from);

                RedoUndoManager.Current.Record(new RUSortLayer(data.from, data.fromIndex, data.fromOwner, trg, trgIndex));

                IBCanvasControl.RefreshAll();
            }
        }