public override Size GetPreferredSize(ViewLayoutContext context)
{
Size preferredSize = Size.Empty;
// Ensure the control has the correct parent
UpdateParent(context.Control);
// If there is a date time picker associated then ask for its requested size
if (LastDateTimePicker != null)
{
if (ActualVisible(LastDateTimePicker))
{
preferredSize = LastDateTimePicker.GetPreferredSize(context.DisplayRectangle.Size);
// Add two pixels, one for the left and right edges that will be padded
preferredSize.Width += 2;
}
}
else
preferredSize.Width = NULL_CONTROL_WIDTH;
if (_currentSize == GroupItemSize.Large)
preferredSize.Height = _ribbon.CalculatedValues.GroupTripleHeight;
else
preferredSize.Height = _ribbon.CalculatedValues.GroupLineHeight;
return preferredSize;
}