Ejemplo n.º 1
0
        private void CollapseChunkToDropDown()
        {
            this.ExpandElementToStep((int)ChunkVisibilityState.Expanded);

            ExpandableStackLayout.InvalidateAll(this);

            SizeF thisSize = this.DesiredSize;

            this.elementWithCaptionLayoutPanel.SuspendThemeRefresh();
            this.Children.Remove(this.elementWithCaptionLayoutPanel);
            this.elementWithCaptionLayoutPanel.ResumeThemeRefresh();

            RadItem item = new RadItem();

            item.UseNewLayoutSystem = true;
            item.AutoSizeMode       = RadAutoSizeMode.WrapAroundChildren;
            item.Children.Add(this.elementWithCaptionLayoutPanel);
            item.MaxSize = new Size(0, thisSize.ToSize().Height);
            item.MinSize = thisSize.ToSize();
            RadDropDownMenu menu = this.dropDownElement.DropDownMenu;
            //remove left column from Menu
            RadDropDownMenuElement menuPopup = (RadDropDownMenuElement)menu.PopupElement;
            StackLayoutPanel       menuStack = menuPopup.LayoutPanel as StackLayoutPanel;

            Debug.Assert(menuStack != null, "Chunk menu stack is null");
            menuStack.Orientation = this.Orientation;
            menuPopup.Layout.LeftColumnMinWidth = 0;
            this.dropDownElement.Items.Add(item);
            //fix for Missing theme if chunk is not expanded
            this.dropDownElement.Visibility = ElementVisibility.Visible;
            this.CollapseStep = (int)ChunkVisibilityState.Collapsed;
            menu.SetTheme();
            menu.MouseUp += new MouseEventHandler(this.menu_MouseUp);
        }
Ejemplo n.º 2
0
 private void SetItems()
 {
     if (this.parentCollection == null || this.parentCollection.Owner == null)
     {
         if (this.tabContentLayout == null || this.tabContentLayout.Parent == null)
         {
             return;
         }
         this.tabContentLayout.Parent.Children.Remove((RadElement)this.tabContentLayout);
     }
     else
     {
         RadElement contentArea = (RadElement)((RadRibbonBar)this.parentCollection.Owner.ElementTree.Control).RibbonBarElement.TabStripElement.ContentArea;
         if (this.tabContentLayout == null)
         {
             this.tabContentLayout = new ExpandableStackLayout();
             this.Items.Owner      = (RadElement)this.tabContentLayout;
         }
         this.tabContentLayout.CollapseElementsOnResize     = true;
         this.tabContentLayout.UseParentSizeAsAvailableSize = true;
         this.tabContentLayout.IsInStripMode = true;
         this.tabContentLayout.Visibility    = ElementVisibility.Collapsed;
         if (contentArea.Children.Contains((RadElement)this.tabContentLayout))
         {
             return;
         }
         contentArea.Children.Add((RadElement)this.tabContentLayout);
     }
 }
Ejemplo n.º 3
0
 public static void InvalidateAll(RadElement baseElement)
 {
     baseElement.InvalidateMeasure();
     baseElement.InvalidateArrange();
     foreach (RadElement child in baseElement.Children)
     {
         ExpandableStackLayout.InvalidateAll(child);
     }
 }
Ejemplo n.º 4
0
        protected override SizeF MeasureOverride(SizeF constraint)
        {
            if (!this.CollapsingEnabled || this.IsDesignMode || constraint == SizeF.Empty)
            {
                return(base.MeasureOverride(constraint));
            }
            ExpandableStackLayout.InvalidateAll((RadElement)this);
            SizeF allElementsSize = this.GetAllElementsSize(constraint);
            int   count           = this.Children.Count;

            if ((double)allElementsSize.Width >= (double)constraint.Width)
            {
                do
                {
                    int possibleCollapseStep;
                    CollapsibleElement elementToCollapse;
                    do
                    {
                        possibleCollapseStep = -1;
                        elementToCollapse    = this.GetElementToCollapse(out possibleCollapseStep);
                        if (elementToCollapse != null)
                        {
                            elementToCollapse.InvalidateMeasure();
                            elementToCollapse.Measure(constraint);
                            SizeF desiredSize = elementToCollapse.DesiredSize;
                            elementToCollapse.SizeBeforeCollapsing = desiredSize;
                        }
                        else
                        {
                            goto label_11;
                        }
                    }while (!elementToCollapse.CollapseElementToStep(possibleCollapseStep));
                    ExpandableStackLayout.InvalidateAll((RadElement)elementToCollapse);
                    elementToCollapse.Measure(constraint);
                    SizeF desiredSize1 = elementToCollapse.DesiredSize;
                    elementToCollapse.SizeAfterCollapsing = desiredSize1;
                    ++this.collapsedElementCount;
                }while ((double)this.GetAllElementsSize(constraint).Width > (double)constraint.Width);
            }
            else
            {
                for (int index = 0; index < count; ++index)
                {
                    int possibleExpandStep             = -1;
                    CollapsibleElement elementToExpand = this.GetElementToExpand(allElementsSize.Width, constraint.Width, out possibleExpandStep);
                    if (elementToExpand != null && ((double)allElementsSize.Width - (double)elementToExpand.DesiredSize.Width + (double)elementToExpand.SizeBeforeCollapsing.Width <= (double)constraint.Width && elementToExpand.ExpandElementToStep(possibleExpandStep)))
                    {
                        --this.collapsedElementCount;
                    }
                }
            }
label_11:
            ExpandableStackLayout.InvalidateAll((RadElement)this);
            return(this.GetAllElementsSize(constraint));
        }
Ejemplo n.º 5
0
        private void CollapseChunkToDropDown()
        {
            this.ExpandElementToStep(1);
            ExpandableStackLayout.InvalidateAll((RadElement)this);
            this.UpdateLayout();
            SizeF size = (SizeF)this.Size;

            this.elementWithCaptionLayoutPanel.SuspendThemeRefresh();
            this.Children.Remove((RadElement)this.elementWithCaptionLayoutPanel);
            this.elementWithCaptionLayoutPanel.ResumeThemeRefresh();
            RadRibbonBarGroup.RadGroupItem radGroupItem = new RadRibbonBarGroup.RadGroupItem();
            radGroupItem.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            radGroupItem.Children.Add((RadElement)this.elementWithCaptionLayoutPanel);
            radGroupItem.MinSize = new Size(size.ToSize().Width, radGroupItem.MinSize.Height);
            RadDropDownMenu        dropDownMenu = this.dropDownElement.DropDownMenu;
            RadDropDownMenuElement popupElement = (RadDropDownMenuElement)dropDownMenu.PopupElement;

            (popupElement.LayoutPanel as StackLayoutPanel).Orientation = this.Orientation;
            popupElement.Layout.LeftColumnMinWidth = 0;
            this.dropDownElement.Items.Add((RadItem)radGroupItem);
            this.dropDownElement.Visibility = ElementVisibility.Visible;
            this.CollapseStep = 4;
            dropDownMenu.SetTheme();
        }