예제 #1
0
        private void DropItems([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var items = (IEnumerable <IItem>)e.Data.GetData(DragManager.DragIdentifier);

            RenderingTreeViewItem rendering = null;

            foreach (var item in items)
            {
                var r = DeviceTreeViewItem.AddRendering(this, item, -1, -1);

                if (rendering == null)
                {
                    rendering = r;
                }
            }

            if (rendering == null)
            {
                return;
            }

            rendering.BringIntoView();
            rendering.Focus();
            Keyboard.Focus(rendering);
        }
예제 #2
0
        private void CopyRenderings([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var placeHolderTreeViewItem = GetParentTreeViewItem() as PlaceHolderTreeViewItem;

            if (placeHolderTreeViewItem == null)
            {
                return;
            }

            var treeViewIndex  = placeHolderTreeViewItem.Items.IndexOf(this);
            var renderingIndex = DeviceTreeViewItem.Device.Renderings.IndexOf(Rendering);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                treeViewIndex++;
                renderingIndex++;
            }

            var items = (IEnumerable <BaseTreeViewItem>)e.Data.GetData(LayoutDesigner.DragIdentifier);

            foreach (var item in items.OfType <RenderingTreeViewItem>())
            {
                var renderingTreeViewItem = DeviceTreeViewItem.AddRendering(placeHolderTreeViewItem, item, treeViewIndex, renderingIndex);
                renderingTreeViewItem.Rendering.CopyFrom(item.Rendering);
                renderingTreeViewItem.Rendering.PlaceholderKey.Key = placeHolderTreeViewItem.PlaceHolderName;
            }
        }
예제 #3
0
        private void CopyRenderings([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var items = (IEnumerable <BaseTreeViewItem>)e.Data.GetData(LayoutDesigner.DragIdentifier);

            foreach (var item in items.OfType <RenderingTreeViewItem>())
            {
                var renderingTreeViewItem = DeviceTreeViewItem.AddRendering(this, item.Rendering, -1, -1);
                renderingTreeViewItem.Rendering.CopyFrom(item.Rendering);
                renderingTreeViewItem.Rendering.PlaceholderKey.Key = PlaceHolderName;
            }
        }
예제 #4
0
        private void DropItems([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var placeHolderTreeViewItem = GetParentTreeViewItem() as PlaceHolderTreeViewItem;

            if (placeHolderTreeViewItem == null)
            {
                return;
            }

            var treeViewIndex  = placeHolderTreeViewItem.Items.IndexOf(this);
            var renderingIndex = DeviceTreeViewItem.Device.Renderings.IndexOf(Rendering);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                treeViewIndex++;
                renderingIndex++;
            }

            var items = (IEnumerable <IItem>)e.Data.GetData(DragManager.DragIdentifier);

            RenderingTreeViewItem rendering = null;

            foreach (var item in items)
            {
                var r = DeviceTreeViewItem.AddRendering(placeHolderTreeViewItem, item, treeViewIndex, renderingIndex);

                if (rendering == null)
                {
                    rendering = r;
                }
            }

            if (rendering == null)
            {
                return;
            }

            rendering.BringIntoView();
            rendering.Focus();
            Keyboard.Focus(rendering);
        }