private void ContextGroupsArrange(SizeF endSize) { float num = 0.0f; ContextualTabGroup rightMostGroup = this.GetRightMostGroup(this.IsDesignMode); for (int index = 0; index < this.RibbonBarElement.ContextualTabGroups.Count; ++index) { ContextualTabGroup contextualTabGroup = this.RibbonBarElement.ContextualTabGroups[index] as ContextualTabGroup; float y = 0.0f; if (contextualTabGroup != null) { if (contextualTabGroup.TabItems.Count == 0) { if (this.IsDesignMode) { if (this.RibbonBarElement.TabStripElement.Items.Count > 0) { RadPageViewItem radPageViewItem = this.RibbonBarElement.TabStripElement.Items[this.RibbonBarElement.TabStripElement.Items.Count - 1]; Point point = this.TransformXToClient(radPageViewItem.ControlBoundingRectangle.Location); if (!this.RightToLeft) { float x = num + (float)point.X + (float)this.GetFullBoundingRect((RadElement)radPageViewItem).Width; contextualTabGroup.Arrange(new RectangleF(x, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), contextualTabGroup.DesiredSize.Height)); num += Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width); } else { float x1 = (float)point.X; num += Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width); float x2 = x1 - num; contextualTabGroup.Arrange(new RectangleF(x2, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), endSize.Height)); } } } } else { RadPageViewItem tabItem1 = contextualTabGroup.TabItems[0] as RadPageViewItem; RadPageViewItem tabItem2 = contextualTabGroup.TabItems[contextualTabGroup.TabItems.Count - 1] as RadPageViewItem; if (tabItem1 != null && tabItem2 != null) { if (contextualTabGroup == rightMostGroup && this.RightToLeft) { contextualTabGroup.Arrange(this.PerformArrangeWithShrink(endSize, contextualTabGroup)); } else { Point point = this.RightToLeft ? this.TransformXToClient(tabItem2.ControlBoundingRectangle.Location) : this.TransformXToClient(tabItem1.ControlBoundingRectangle.Location); contextualTabGroup.Arrange(new RectangleF((float)point.X, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), endSize.Height)); } } } } } }
private void ContextGroupsArrange(SizeF endSize) { float offset = 0; ContextualTabGroup rightMostGroup = this.GetRightMostGroup(this.IsDesignMode); for (int i = 0; i < this.contextualTabGroups.Count; i++) { ContextualTabGroup tabGroup = this.contextualTabGroups[i] as ContextualTabGroup; float yCoord = (endSize.Height - tabGroup.DesiredSize.Height) / 2; if (tabGroup != null) { if (tabGroup.TabItems.Count == 0) { //Arrange the empty contextual tab groups only in design time if (this.IsDesignMode) { float groupXCoord = 0; if (this.tabStripElement.Items.Count > 0) { RadPageViewItem item = this.tabStripElement.Items[this.tabStripElement.Items.Count - 1] as RadPageViewItem; Point relativeTabLocation = this.TransformXToClient(item.ControlBoundingRectangle.Location); if (!this.RightToLeft) { groupXCoord = offset + relativeTabLocation.X + item.FullBoundingRectangle.Width; tabGroup.Arrange(new RectangleF(groupXCoord, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); offset += tabGroup.DesiredSize.Width; } else { groupXCoord = relativeTabLocation.X; offset += tabGroup.DesiredSize.Width; groupXCoord -= offset; tabGroup.Arrange(new RectangleF(groupXCoord, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); } } } } else { RadPageViewItem leftMost = tabGroup.TabItems[0] as RadPageViewItem; RadPageViewItem rightMost = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; if (leftMost != null && rightMost != null) { if (tabGroup == rightMostGroup && this.RightToLeft) { tabGroup.Arrange(this.PerformArrangeWithShrink(endSize, tabGroup)); } else { Point relativeTabLocation; if (!this.RightToLeft) { relativeTabLocation = this.TransformXToClient(leftMost.ControlBoundingRectangle.Location); } else { relativeTabLocation = this.TransformXToClient(rightMost.ControlBoundingRectangle.Location); } tabGroup.Arrange(new RectangleF(relativeTabLocation.X, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); } } } } } }