Example #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);
        }
Example #2
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);
        }