Пример #1
0
 protected override void ValidateDockedHeight(SplitterLength height)
 {
     if (height.IsFill)
     {
         throw new ArgumentException("NestedGroup does not accept Fill values for DockedHeight.");
     }
 }
Пример #2
0
        public void Initialize(ViewElement view)
        {
            this.sibling = DraggedTabInfo.FindFirstSibling(view);
            ViewGroup parent = view.Parent;

            this.nestedGroup         = (ViewElement)null;
            this.groupPosition       = -1;
            this.groupFloatingHeight = 0.0;
            this.groupFloatingWidth  = 0.0;
            this.groupContainer      = (DocumentGroupContainer)null;
            if (parent == null)
            {
                return;
            }
            if (parent.Parent != null)
            {
                this.groupPosition = parent.Parent.Children.IndexOf((ViewElement)parent);
                if (parent != null && parent.Children.Count == 1 && parent.Parent.Children.Count == 1)
                {
                    this.nestedGroup = (ViewElement)parent;
                }
            }
            this.groupDockedWidth    = parent.DockedWidth;
            this.groupDockedHeight   = parent.DockedHeight;
            this.groupFloatingWidth  = parent.FloatingWidth;
            this.groupFloatingHeight = parent.FloatingHeight;
            this.groupContainer      = parent.Parent as DocumentGroupContainer;
        }
Пример #3
0
 protected override void ValidateDockedWidth(SplitterLength width)
 {
     if (width.IsFill)
     {
         throw new ArgumentException("NestedGroup does not accept Fill values for DockedWidth.");
     }
 }
Пример #4
0
        private Rect PreviewDockCounterOrientation(DockDirection dockDirection, FrameworkElement adornedElement, ViewElement viewElement, SplitterLength itemLength, Orientation orientation)
        {
            List <UIElement> list          = new List <UIElement>();
            Point            point1        = new Point(0.0, 0.0);
            SplitterItem     splitterItem1 = new SplitterItem();
            int          index             = 0;
            Size         availableSize     = new Size(adornedElement.ActualWidth, adornedElement.ActualHeight);
            SplitterItem splitterItem2     = new SplitterItem();

            list.Add((UIElement)splitterItem2);
            if (dockDirection == DockDirection.Right || dockDirection == DockDirection.Bottom)
            {
                index = 1;
            }
            list.Insert(index, (UIElement)splitterItem1);
            SplitterLength splitterLength = !(viewElement is MainSite) ? (orientation == Orientation.Horizontal ? viewElement.DockedWidth : viewElement.DockedHeight) : new SplitterLength(1.0, SplitterUnitType.Fill);

            SplitterPanel.SetSplitterLength((UIElement)splitterItem2, splitterLength);
            SplitterPanel.SetSplitterLength((UIElement)splitterItem1, itemLength);
            Point point2 = DpiHelper.DeviceToLogicalUnits(adornedElement.PointToScreen(new Point(0.0, 0.0)));

            Rect[] elementBounds;
            SplitterPanel.Measure(availableSize, orientation, (IEnumerable)list, false, out elementBounds, (SplitterPanel)null);
            Rect rect = elementBounds[index];

            rect.Offset(point2.X, point2.Y);
            return(rect);
        }
Пример #5
0
        private Rect GetDockPreviewRect(DockDirection dockDirection, FrameworkElement adornedElement, ViewElement element)
        {
            Rect           rect1       = new Rect();
            Orientation    orientation = Orientation.Horizontal;
            ViewElement    viewElement = adornedElement.DataContext as ViewElement;
            SplitterLength itemLength  = new SplitterLength();

            if (dockDirection == DockDirection.FirstValue || dockDirection == DockDirection.Bottom)
            {
                orientation = Orientation.Vertical;
                itemLength  = element.DockedHeight;
            }
            else if (dockDirection == DockDirection.Left || dockDirection == DockDirection.Right)
            {
                orientation = Orientation.Horizontal;
                itemLength  = element.DockedWidth;
            }
            Rect rect2;

            if (dockDirection != DockDirection.Fill)
            {
                SplitterPanel panel       = (SplitterPanel)null;
                int           targetIndex = -1;
                this.GetPreviewSplitterPanel(out panel, out targetIndex, dockDirection, viewElement, adornedElement, orientation);
                rect2 = panel == null || orientation != panel.Orientation ? this.PreviewDockCounterOrientation(dockDirection, adornedElement, viewElement, itemLength, orientation) : this.PreviewDockSameOrientation(dockDirection, panel, viewElement, itemLength, orientation, targetIndex);
            }
            else
            {
                rect2 = this.PreviewDockFill(adornedElement);
            }
            return(rect2);
        }
Пример #6
0
        private Rect PreviewDockSameOrientation(DockDirection dockDirection, SplitterPanel panel, ViewElement viewElement, SplitterLength itemLength, Orientation orientation, int originalIndex)
        {
            List <UIElement> list          = new List <UIElement>();
            Point            point1        = new Point(0.0, 0.0);
            SplitterItem     splitterItem1 = new SplitterItem();
            Size             availableSize = new Size();

            availableSize.Width  = panel.ActualWidth;
            availableSize.Height = panel.ActualHeight;
            SplitterItem splitterItem2 = (SplitterItem)null;

            foreach (SplitterItem splitterItem3 in panel.Children)
            {
                list.Add((UIElement)splitterItem3);
                if (splitterItem3.Content == viewElement)
                {
                    splitterItem2 = splitterItem3;
                    panel.Children.IndexOf((UIElement)splitterItem2);
                }
            }
            int index = splitterItem2 != null?list.IndexOf((UIElement)splitterItem2) : originalIndex;

            if (dockDirection == DockDirection.Right || dockDirection == DockDirection.Bottom)
            {
                ++index;
            }
            list.Insert(index, (UIElement)splitterItem1);
            SplitterPanel.SetSplitterLength((UIElement)splitterItem1, itemLength);
            Point point2 = DpiHelper.DeviceToLogicalUnits(panel.PointToScreen(new Point(0.0, 0.0)));

            Rect[] elementBounds;
            SplitterPanel.Measure(availableSize, orientation, (IEnumerable)list, false, out elementBounds, panel);
            Rect rect = elementBounds[index];

            rect.Offset(point2.X, point2.Y);
            return(rect);
        }
Пример #7
0
 protected virtual void ValidateDockedHeight(SplitterLength height)
 {
 }
Пример #8
0
 protected virtual void ValidateDockedWidth(SplitterLength width)
 {
 }