protected override SizeF MeasureItems(SizeF availableSize)
        {
            availableSize = this.GetCorrectedScrollbarClientRectangle(new RectangleF(Point.Empty, availableSize)).Size;

            SizeF desiredSize = base.MeasureItems(availableSize);

            //SizeF originalDesiredSize = desiredSize;

            if (this.Owner == null)
            {
                availableSize.Height -= desiredSize.Height;
            }

            foreach (ExplorerBarItemSizeInfo sizeInfo in this.layoutInfo.items)
            {
                if (this.Owner == null)
                {
                    availableSize.Height = float.PositiveInfinity;

                    RadPageViewExplorerBarItem explorerBarItem = (RadPageViewExplorerBarItem)sizeInfo.item;
                    if (explorerBarItem.AssociatedContentAreaElement != null && explorerBarItem.IsExpanded)
                    {
                        explorerBarItem.AssociatedContentAreaElement.Measure(availableSize);
                        if (StackPosition == StackViewPosition.Top)
                        {
                            desiredSize.Height += explorerBarItem.AssociatedContentAreaElement.DesiredSize.Height;
                            desiredSize.Width   = Math.Max(desiredSize.Width, explorerBarItem.AssociatedContentAreaElement.DesiredSize.Width);
                            //availableSize.Height -= explorerBarItem.AssociatedContentAreaElement.DesiredSize.Height;
                        }
                        else
                        {
                            desiredSize.Width += explorerBarItem.AssociatedContentAreaElement.DesiredSize.Width;
                            desiredSize.Height = Math.Max(desiredSize.Height, explorerBarItem.AssociatedContentAreaElement.DesiredSize.Height);
                            //availableSize.Width -= explorerBarItem.AssociatedContentAreaElement.DesiredSize.Width;
                        }
                        sizeInfo.contentSize = explorerBarItem.AssociatedContentAreaElement.DesiredSize;
                    }
                }
                else
                {
                    sizeInfo.contentSize = this.GetContentSizeForItem(sizeInfo, new RectangleF(Point.Empty, availableSize));
                }
            }

            return(desiredSize);
        }
        protected override RadPageViewItem CreateItem()
        {
            RadPageViewExplorerBarItem item = new RadPageViewExplorerBarItem();

            if (this.Items.Count == 0)
            {
                item.AssociatedContentAreaElement = this.ContentArea as RadPageViewContentAreaElement;
            }
            else
            {
                RadPageViewContentAreaElement contentElement = new RadPageViewContentAreaElement();
                contentElement.Visibility         = ElementVisibility.Collapsed;
                item.AssociatedContentAreaElement = contentElement;
                contentElement.Owner = this;
            }

            return(item);
        }
        protected override RectangleF ArrangeContent(RectangleF clientRect)
        {
            List <ContentAreaLayoutInfo> layoutInfos    = this.GetContentAreaLayoutInfos(clientRect);
            ExplorerBarLayoutInfo        explLayoutInfo = this.layoutInfo as ExplorerBarLayoutInfo;

            explLayoutInfo.fullLayoutLength = explLayoutInfo.layoutLength;
            foreach (ContentAreaLayoutInfo contentAreaLayoutInfo in layoutInfos)
            {
                RadPageViewExplorerBarItem    item = (contentAreaLayoutInfo.AssociatedItem as RadPageViewExplorerBarItem);
                RadPageViewContentAreaElement contentAreaElement = item.AssociatedContentAreaElement;
                contentAreaElement.Arrange(contentAreaLayoutInfo.ContentAreaRectangle);

                switch (explLayoutInfo.position)
                {
                case StackViewPosition.Top:
                    explLayoutInfo.fullLayoutLength += contentAreaLayoutInfo.ContentAreaRectangle.Height;
                    break;

                case StackViewPosition.Left:
                    explLayoutInfo.fullLayoutLength += contentAreaLayoutInfo.ContentAreaRectangle.Width;
                    break;
                }
            }

            this.OnContentBoundsChanged();

            switch (explLayoutInfo.position)
            {
            case StackViewPosition.Top:
                if (this.Header.Visibility == ElementVisibility.Visible)
                {
                    explLayoutInfo.fullLayoutLength += this.Header.Margin.Bottom;
                }
                if (this.Footer.Visibility == ElementVisibility.Visible)
                {
                    explLayoutInfo.fullLayoutLength += this.Footer.Margin.Top;
                }
                break;
            }
            explLayoutInfo.fullLayoutLength -= explLayoutInfo.expandedItemsCount * explLayoutInfo.itemSpacing;
            return(clientRect);
        }
 private void SetPageVisibility(RadPageViewExplorerBarItem item)
 {
     if (this.Owner == null && item.AssociatedContentAreaElement != null)
     {
         if (item.IsExpanded)
         {
             item.AssociatedContentAreaElement.Visibility = ElementVisibility.Visible;
         }
         else
         {
             item.AssociatedContentAreaElement.Visibility = ElementVisibility.Collapsed;
         }
         return;
     }
     if (item.Page == null)
     {
         return;
     }
     if (this.Owner != null && this.Owner.IsHandleCreated)
     {
         item.Page.Visible = item.IsExpanded;
     }
 }
Example #5
0
 public ExplorerBarItemSizeInfo(RadPageViewExplorerBarItem item, bool vertical, bool isExpanded)
     : base((RadPageViewItem)item, vertical)
 {
     this.IsExpanded = isExpanded;
 }
 public RadPageViewExpandedChangedEventArgs(RadPageViewExplorerBarItem item)
 {
     this.item = item;
 }
 public override void SetContent()
 {
     if (this.pageViewElement is RadPageViewExplorerBarElement)
     {
         RadPageViewItem radPageViewItem = (RadPageViewItem)null;
         for (int index = this.pageViewElement.Items.Count - 1; index >= 0; --index)
         {
             if (this.HierarchyRow.Views[index].ViewTemplate != this.ViewTemplate)
             {
                 RadPageViewExplorerBarItem viewExplorerBarItem = (RadPageViewExplorerBarItem)this.pageViewElement.Items[index];
                 GridViewInfo     view  = this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1];
                 GridTableElement child = (GridTableElement)viewExplorerBarItem.AssociatedContentAreaElement.Children[0];
                 if (viewExplorerBarItem.Tag != view || child.ViewTemplate == null)
                 {
                     this.InitializePageViewItem((RadPageViewItem)viewExplorerBarItem, view);
                     child.Detach();
                     child.Initialize(this.GridViewElement, view);
                     if (view == this.HierarchyRow.ActiveView)
                     {
                         radPageViewItem = (RadPageViewItem)viewExplorerBarItem;
                         this.rowView    = child;
                     }
                 }
             }
         }
         if (radPageViewItem == null)
         {
             return;
         }
         this.pageViewElement.SelectedItem = radPageViewItem;
     }
     else
     {
         if (this.pageViewElement != null)
         {
             RadPageViewItem radPageViewItem1 = (RadPageViewItem)null;
             if (this.pageViewElement is RadPageViewStripElement || this.pageViewElement is RadPageViewOutlookElement)
             {
                 int index1 = this.ViewTemplate.IsSelfReference ? 1 : 0;
                 int index2 = 0;
                 while (index2 < this.pageViewElement.Items.Count)
                 {
                     if (this.HierarchyRow.Views[index1].ViewTemplate != this.ViewTemplate)
                     {
                         RadPageViewItem radPageViewItem2 = this.pageViewElement.Items[index2];
                         GridViewInfo    view             = this.HierarchyRow.Views[index1];
                         this.InitializePageViewItem(radPageViewItem2, view);
                         if (view == this.HierarchyRow.ActiveView)
                         {
                             radPageViewItem1 = radPageViewItem2;
                         }
                     }
                     ++index2;
                     ++index1;
                 }
             }
             else
             {
                 for (int index = this.pageViewElement.Items.Count - 1; index >= 0; --index)
                 {
                     if (this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1].ViewTemplate != this.ViewTemplate)
                     {
                         RadPageViewItem radPageViewItem2 = this.pageViewElement.Items[index];
                         GridViewInfo    view             = this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1];
                         this.InitializePageViewItem(radPageViewItem2, view);
                         if (view == this.HierarchyRow.ActiveView)
                         {
                             radPageViewItem1 = radPageViewItem2;
                         }
                     }
                 }
             }
             if (radPageViewItem1 != null)
             {
                 this.suspendTabChanging           = true;
                 this.pageViewElement.SelectedItem = radPageViewItem1;
                 this.suspendTabChanging           = false;
             }
         }
         if (this.rowView.ViewInfo != this.HierarchyRow.ActiveView)
         {
             bool flag = this.rowView.ViewTemplate != this.HierarchyRow.ActiveView.ViewTemplate;
             this.rowView.Detach();
             this.rowView.Initialize(this.GridViewElement, this.HierarchyRow.ActiveView);
             if (!flag)
             {
                 return;
             }
             this.UpdateRowViewLayout();
         }
         else
         {
             this.rowView.ViewElement.UpdateRows();
         }
     }
 }