/// <summary>
/// Show the group popup relative to the parent group instance.
/// </summary>
/// <param name="parentGroup">Parent group instance.</param>
/// <param name="parentScreenRect">Screen rectangle of the parent.</param>
public void ShowCalculatingSize(ViewDrawRibbonGroup parentGroup,
Rectangle parentScreenRect)
{
Size popupSize;
// Prevent ribbon from laying out the same group as we are
// about to get the preferred size from. This reentrancy can
// happen if the group has a custom control that is then moved
// to be reparented to the popup group and so therefore cause
// a layout of the main ribbon.
_ribbon.SuspendLayout();
SuspendLayout();
try
{
// Find the size the group requests to be
using (ViewLayoutContext context = new ViewLayoutContext(this, Renderer))
popupSize = _viewGroup.GetPreferredSize(context);
// Override the height to enforce the correct group height
popupSize.Height = _ribbon.CalculatedValues.GroupHeight;
// Mark the group as showing as a popup
_ribbonGroup.ShowingAsPopup = true;
// Request we be shown below the parent screen rect
Show(CalculateBelowPopupRect(parentScreenRect, popupSize));
}
finally
{
// Reverse the suspend call
_ribbon.ResumeLayout();
ResumeLayout();
}
}