Beispiel #1
0
        IEnumerable <IDropTarget> IOverlayWindow.GetTargets()
        {
            foreach (var visibleArea in _visibleAreas)
            {
                switch (visibleArea.Type)
                {
                case DropAreaType.DockingManager:
                {
                    var dropAreaDockingManager = visibleArea as DropArea <DockingManager>;
                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetLeft.GetScreenArea(), DropTargetType.DockingManagerDockLeft));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetTop.GetScreenArea(), DropTargetType.DockingManagerDockTop));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetBottom.GetScreenArea(), DropTargetType.DockingManagerDockBottom));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetRight.GetScreenArea(), DropTargetType.DockingManagerDockRight));
                }
                break;

                case DropAreaType.AnchorablePane:
                {
                    var dropAreaAnchorablePane = visibleArea as DropArea <LayoutAnchorablePaneControl>;
                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetLeft.GetScreenArea(), DropTargetType.AnchorablePaneDockLeft));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetTop.GetScreenArea(), DropTargetType.AnchorablePaneDockTop));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetRight.GetScreenArea(), DropTargetType.AnchorablePaneDockRight));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetBottom.GetScreenArea(), DropTargetType.AnchorablePaneDockBottom));

                    if (_anchorablePaneDropTargetInto.IsVisible)
                    {
                        yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));
                    }

                    var parentPaneModel = dropAreaAnchorablePane.AreaElement.Model as LayoutAnchorablePane;
                    LayoutAnchorableTabItem lastAreaTabItem = null;
                    foreach (var dropAreaTabItem in dropAreaAnchorablePane.AreaElement.FindVisualChildren <LayoutAnchorableTabItem>())
                    {
                        var tabItemModel = dropAreaTabItem.Model as LayoutAnchorable;
                        lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                          dropAreaTabItem : lastAreaTabItem;
                        int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                        yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.AnchorablePaneDockInside, tabIndex));
                    }

                    if (lastAreaTabItem != null)
                    {
                        var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                        var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                        if (newAreaTabItemScreenArea.Right < dropAreaAnchorablePane.AreaElement.GetScreenArea().Right)
                        {
                            yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, newAreaTabItemScreenArea, DropTargetType.AnchorablePaneDockInside, parentPaneModel.Children.Count));
                        }
                    }

                    var dropAreaTitle = dropAreaAnchorablePane.AreaElement.FindVisualChildren <AnchorablePaneTitle>().FirstOrDefault();
                    if (dropAreaTitle != null)
                    {
                        yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTitle.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));
                    }
                }
                break;

                case DropAreaType.DocumentPane:
                {
                    bool isDraggingAnchorables = _floatingWindow.Model is LayoutAnchorableFloatingWindow;
                    if (isDraggingAnchorables && _gridDocumentPaneFullDropTargets != null)
                    {
                        var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (_documentPaneFullDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (_documentPaneFullDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (_documentPaneFullDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (_documentPaneFullDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (_documentPaneFullDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }

                        var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem lastAreaTabItem = null;
                        foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            var tabItemModel = dropAreaTabItem.Model;
                            lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                              dropAreaTabItem : lastAreaTabItem;
                            int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex));
                        }

                        if (lastAreaTabItem != null)
                        {
                            var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                            var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                            if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count));
                            }
                        }

                        if (_documentPaneDropTargetLeftAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeftAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableLeft));
                        }
                        if (_documentPaneDropTargetTopAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTopAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableTop));
                        }
                        if (_documentPaneDropTargetRightAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRightAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableRight));
                        }
                        if (_documentPaneDropTargetBottomAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottomAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableBottom));
                        }
                    }
                    else
                    {
                        var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (_documentPaneDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (_documentPaneDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (_documentPaneDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (_documentPaneDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (_documentPaneDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }

                        var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem lastAreaTabItem = null;
                        foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            var tabItemModel = dropAreaTabItem.Model;
                            lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                              dropAreaTabItem : lastAreaTabItem;
                            int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex));
                        }

                        if (lastAreaTabItem != null)
                        {
                            var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                            var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                            if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count));
                            }
                        }
                    }
                }
                break;

                case DropAreaType.DocumentPaneGroup:
                {
                    var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneGroupControl>;
                    if (_documentPaneDropTargetInto.IsVisible)
                    {
                        yield return(new DocumentPaneGroupDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneGroupDockInside));
                    }
                }
                break;
                }
            }
            yield break;
        }
Beispiel #2
0
        IEnumerable <IDropTarget> Xceed.Wpf.AvalonDock.Controls.IOverlayWindow.GetTargets()
        {
            LayoutDocumentTabItem   layoutDocumentTabItem;
            LayoutDocumentTabItem   layoutDocumentTabItem1;
            LayoutAnchorableTabItem layoutAnchorableTabItem;

            foreach (IDropArea _visibleArea in this._visibleAreas)
            {
                switch (_visibleArea.Type)
                {
                case DropAreaType.DockingManager:
                {
                    DropArea <DockingManager> dropArea = _visibleArea as DropArea <DockingManager>;
                    yield return(new DockingManagerDropTarget(dropArea.AreaElement, this._dockingManagerDropTargetLeft.GetScreenArea(), DropTargetType.DockingManagerDockLeft));

                    yield return(new DockingManagerDropTarget(dropArea.AreaElement, this._dockingManagerDropTargetTop.GetScreenArea(), DropTargetType.DockingManagerDockTop));

                    yield return(new DockingManagerDropTarget(dropArea.AreaElement, this._dockingManagerDropTargetBottom.GetScreenArea(), DropTargetType.DockingManagerDockBottom));

                    yield return(new DockingManagerDropTarget(dropArea.AreaElement, this._dockingManagerDropTargetRight.GetScreenArea(), DropTargetType.DockingManagerDockRight));

                    dropArea = null;
                    break;
                }

                case DropAreaType.DocumentPane:
                {
                    if (!(this._floatingWindow.Model is LayoutAnchorableFloatingWindow) || this._gridDocumentPaneFullDropTargets == null)
                    {
                        DropArea <LayoutDocumentPaneControl> dropArea1 = _visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (this._documentPaneDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, this._documentPaneDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (this._documentPaneDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, this._documentPaneDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (this._documentPaneDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, this._documentPaneDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (this._documentPaneDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, this._documentPaneDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (this._documentPaneDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, this._documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }
                        LayoutDocumentPane    model = dropArea1.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem layoutDocumentTabItem2 = null;
                        foreach (LayoutDocumentTabItem layoutDocumentTabItem3 in dropArea1.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            LayoutContent layoutContent = layoutDocumentTabItem3.Model;
                            layoutDocumentTabItem  = (layoutDocumentTabItem2 == null || layoutDocumentTabItem2.GetScreenArea().Right < layoutDocumentTabItem3.GetScreenArea().Right ? layoutDocumentTabItem3 : layoutDocumentTabItem2);
                            layoutDocumentTabItem2 = layoutDocumentTabItem;
                            int num = model.Children.IndexOf(layoutContent);
                            yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, layoutDocumentTabItem3.GetScreenArea(), DropTargetType.DocumentPaneDockInside, num));
                        }
                        if (layoutDocumentTabItem2 != null)
                        {
                            Rect screenArea = layoutDocumentTabItem2.GetScreenArea();
                            Rect rect       = new Rect(screenArea.TopRight, new Point(screenArea.Right + screenArea.Width, screenArea.Bottom));
                            if (rect.Right < dropArea1.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropArea1.AreaElement, rect, DropTargetType.DocumentPaneDockInside, model.Children.Count));
                            }
                        }
                        dropArea1 = null;
                        model     = null;
                        layoutDocumentTabItem2 = null;
                        break;
                    }
                    else
                    {
                        DropArea <LayoutDocumentPaneControl> dropArea2 = _visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (this._documentPaneFullDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, this._documentPaneFullDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (this._documentPaneFullDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, this._documentPaneFullDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (this._documentPaneFullDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, this._documentPaneFullDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (this._documentPaneFullDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, this._documentPaneFullDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (this._documentPaneFullDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, this._documentPaneFullDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }
                        LayoutDocumentPane    layoutDocumentPane     = dropArea2.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem layoutDocumentTabItem4 = null;
                        foreach (LayoutDocumentTabItem layoutDocumentTabItem5 in dropArea2.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            LayoutContent model1 = layoutDocumentTabItem5.Model;
                            layoutDocumentTabItem1 = (layoutDocumentTabItem4 == null || layoutDocumentTabItem4.GetScreenArea().Right < layoutDocumentTabItem5.GetScreenArea().Right ? layoutDocumentTabItem5 : layoutDocumentTabItem4);
                            layoutDocumentTabItem4 = layoutDocumentTabItem1;
                            int num1 = layoutDocumentPane.Children.IndexOf(model1);
                            yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, layoutDocumentTabItem5.GetScreenArea(), DropTargetType.DocumentPaneDockInside, num1));
                        }
                        if (layoutDocumentTabItem4 != null)
                        {
                            Rect screenArea1 = layoutDocumentTabItem4.GetScreenArea();
                            Rect rect1       = new Rect(screenArea1.TopRight, new Point(screenArea1.Right + screenArea1.Width, screenArea1.Bottom));
                            if (rect1.Right < dropArea2.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropArea2.AreaElement, rect1, DropTargetType.DocumentPaneDockInside, layoutDocumentPane.Children.Count));
                            }
                        }
                        if (this._documentPaneDropTargetLeftAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropArea2.AreaElement, this._documentPaneDropTargetLeftAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableLeft));
                        }
                        if (this._documentPaneDropTargetTopAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropArea2.AreaElement, this._documentPaneDropTargetTopAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableTop));
                        }
                        if (this._documentPaneDropTargetRightAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropArea2.AreaElement, this._documentPaneDropTargetRightAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableRight));
                        }
                        if (this._documentPaneDropTargetBottomAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropArea2.AreaElement, this._documentPaneDropTargetBottomAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableBottom));
                        }
                        dropArea2              = null;
                        layoutDocumentPane     = null;
                        layoutDocumentTabItem4 = null;
                        break;
                    }
                }

                case DropAreaType.DocumentPaneGroup:
                {
                    DropArea <LayoutDocumentPaneGroupControl> dropArea3 = _visibleArea as DropArea <LayoutDocumentPaneGroupControl>;
                    if (!this._documentPaneDropTargetInto.IsVisible)
                    {
                        break;
                    }
                    yield return(new DocumentPaneGroupDropTarget(dropArea3.AreaElement, this._documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneGroupDockInside));

                    break;
                }

                case DropAreaType.AnchorablePane:
                {
                    DropArea <LayoutAnchorablePaneControl> dropArea4 = _visibleArea as DropArea <LayoutAnchorablePaneControl>;
                    yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, this._anchorablePaneDropTargetLeft.GetScreenArea(), DropTargetType.AnchorablePaneDockLeft));

                    yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, this._anchorablePaneDropTargetTop.GetScreenArea(), DropTargetType.AnchorablePaneDockTop));

                    yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, this._anchorablePaneDropTargetRight.GetScreenArea(), DropTargetType.AnchorablePaneDockRight));

                    yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, this._anchorablePaneDropTargetBottom.GetScreenArea(), DropTargetType.AnchorablePaneDockBottom));

                    yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, this._anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));

                    LayoutAnchorablePane    layoutAnchorablePane     = dropArea4.AreaElement.Model as LayoutAnchorablePane;
                    LayoutAnchorableTabItem layoutAnchorableTabItem1 = null;
                    foreach (LayoutAnchorableTabItem layoutAnchorableTabItem2 in dropArea4.AreaElement.FindVisualChildren <LayoutAnchorableTabItem>())
                    {
                        LayoutAnchorable layoutAnchorable = layoutAnchorableTabItem2.Model as LayoutAnchorable;
                        layoutAnchorableTabItem  = (layoutAnchorableTabItem1 == null || layoutAnchorableTabItem1.GetScreenArea().Right < layoutAnchorableTabItem2.GetScreenArea().Right ? layoutAnchorableTabItem2 : layoutAnchorableTabItem1);
                        layoutAnchorableTabItem1 = layoutAnchorableTabItem;
                        int num2 = layoutAnchorablePane.Children.IndexOf(layoutAnchorable);
                        yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, layoutAnchorableTabItem2.GetScreenArea(), DropTargetType.AnchorablePaneDockInside, num2));
                    }
                    if (layoutAnchorableTabItem1 != null)
                    {
                        Rect screenArea2 = layoutAnchorableTabItem1.GetScreenArea();
                        Rect rect2       = new Rect(screenArea2.TopRight, new Point(screenArea2.Right + screenArea2.Width, screenArea2.Bottom));
                        if (rect2.Right < dropArea4.AreaElement.GetScreenArea().Right)
                        {
                            yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, rect2, DropTargetType.AnchorablePaneDockInside, layoutAnchorablePane.Children.Count));
                        }
                    }
                    AnchorablePaneTitle anchorablePaneTitle = dropArea4.AreaElement.FindVisualChildren <AnchorablePaneTitle>().FirstOrDefault <AnchorablePaneTitle>();
                    if (anchorablePaneTitle != null)
                    {
                        yield return(new AnchorablePaneDropTarget(dropArea4.AreaElement, anchorablePaneTitle.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));
                    }
                    dropArea4                = null;
                    layoutAnchorablePane     = null;
                    layoutAnchorableTabItem1 = null;
                    break;
                }
                }
            }
        }