Пример #1
0
            public DockableCollectionDescriptor(DockableCollection dockableCollection, DockDescriptor dock, int internalId)
            {
                DockableCollection = dockableCollection;
                Description        = dockableCollection.Description;
                DockPosition       = DockingPanel.GetDockPosition(dockableCollection);
                State       = dockableCollection.State;
                TabPosition = dockableCollection.TabPosition;
                HorizontalContentAlignment = dockableCollection.HorizontalContentAlignment;
                VerticalContentAlignment   = dockableCollection.VerticalContentAlignment;

                if (dockableCollection.IsCollapsed)
                {
                    CollapsedTabPosition = dockableCollection.CollapsedTabPosition;
                }
                else
                {
                    LayoutContext layoutContext = DockingPanel.GetLayoutContext(dockableCollection);
                    Left                   = layoutContext.Left.Value;
                    Top                    = layoutContext.Top.Value;
                    LayoutHeight           = layoutContext.Size.Height.HasInternalValue ? layoutContext.Size.Height.InternalValue : (double?)null;
                    LayoutWidth            = layoutContext.Size.Width.HasInternalValue ? layoutContext.Size.Width.InternalValue : (double?)null;
                    Height                 = layoutContext.Size.Height.UserValue;
                    Width                  = layoutContext.Size.Width.UserValue;
                    IsHeightSplitterActive = layoutContext.Size.Height.IsSplitterActive;
                    IsWidthSplitterActive  = layoutContext.Size.Width.IsSplitterActive;
                }

                BottomPeers = new List <int>();
                LeftPeers   = new List <int>();
                RightPeers  = new List <int>();
                TopPeers    = new List <int>();
                Content     = new List <DockableContentDescriptor>();

                InternalId = internalId;

                dock.DockedCollections.Add(this);

                int contentId = 1;

                foreach (FrameworkElement dockableContent in dockableCollection.Items)
                {
                    if (dockableCollection.VisibleContent == dockableContent)
                    {
                        CurrentTab = contentId;
                    }
                    new DockableContentDescriptor(dockableContent, this, contentId++);
                }
            }
Пример #2
0
        public static DockPosition ToEtoTabPosition(this swc.Dock dock)
        {
            switch (dock)
            {
            case swc.Dock.Left:
                return(DockPosition.Left);

            case swc.Dock.Top:
                return(DockPosition.Top);

            case swc.Dock.Right:
                return(DockPosition.Right);

            case swc.Dock.Bottom:
                return(DockPosition.Bottom);

            default:
                throw new NotSupportedException();
            }
        }
Пример #3
0
        public void SetDock(UIElement element, System.Windows.Controls.Dock dock)
        {
            switch (dock)
            {
            case System.Windows.Controls.Dock.Bottom:
                RadDockPanel.SetDock(element, Telerik.Windows.Controls.Dock.Bottom);
                break;

            case System.Windows.Controls.Dock.Left:
                RadDockPanel.SetDock(element, Telerik.Windows.Controls.Dock.Left);
                break;

            case System.Windows.Controls.Dock.Right:
                RadDockPanel.SetDock(element, Telerik.Windows.Controls.Dock.Right);
                break;

            case System.Windows.Controls.Dock.Top:
                RadDockPanel.SetDock(element, Telerik.Windows.Controls.Dock.Top);
                break;
            }
        }
 internal CollapsedCollectionContentView(ItemCollection collections, System.Windows.Controls.Dock collapsedTabPosition) : base(collections, Satisfies, HasPredicateChanged)
 {
     CollapsedTabPosition = collapsedTabPosition;
 }
Пример #5
0
        internal void InsertByLocation(DockableCollection visual, Rect bounds, System.Windows.Controls.Dock defaultPosition)
        {
            using (new Activity(this))
            {
                LayoutContext layoutContext = GetLayoutContext(visual);
                LayoutContext reference     = (LayoutContexts[0] == layoutContext ? LayoutContexts[1] : LayoutContexts[0]);

                //  If the dock resized (smaller) and the bounds are outside the dock, position the visual at the right or bottom edge

                if (bounds.Left >= ActualWidth)
                {
                    layoutContext.InsertRight(reference);
                }
                else if (bounds.Top >= ActualHeight)
                {
                    layoutContext.InsertBottom(reference);
                }
                else
                {
                    //  Find the visual where the new visual's midpoint was

                    double        centerX           = (bounds.Left + bounds.Right) / 2;
                    double        centerY           = (bounds.Top + bounds.Bottom) / 2;
                    LayoutContext midpointReference = FindMidPoint(centerX, centerY);
                    if (midpointReference == null)
                    {
                        //  The midpoint is outside the dock

                        InsertByDockPosition(layoutContext, defaultPosition);
                    }
                    else
                    {
                        //  Position the visual relative to this reference

                        double referenceX = (midpointReference.Left.Value + midpointReference.Right.Value) / 2;
                        double referenceY = (midpointReference.Top.Value + midpointReference.Bottom.Value) / 2;

                        if (Math.Abs(centerX - referenceX) < MinimumChildSize.Width / 2)
                        {
                            if (centerY < referenceY)
                            {
                                midpointReference.InsertAbove(layoutContext);
                            }
                            else
                            {
                                midpointReference.InsertBelow(layoutContext);
                            }
                        }
                        else if (Math.Abs(centerY - referenceY) < MinimumChildSize.Height / 2)
                        {
                            if (centerX < referenceX)
                            {
                                midpointReference.InsertToLeftOf(layoutContext);
                            }
                            else
                            {
                                midpointReference.InsertToRightOf(layoutContext);
                            }
                        }
                        else
                        {
                            midpointReference.InsertBelow(layoutContext);
                        }
                    }
                }
            }
        }