protected override void OnSizeRequested(ref Requisition requisition) { base.OnSizeRequested(ref requisition); upReq = up.SizeRequest(); downReq = down.SizeRequest(); expandReq = expand.SizeRequest(); btnWidth = Math.Max(upReq.Width, Math.Max(downReq.Width, expandReq.Width)); int btnHeight = upReq.Height + downReq.Height + expandReq.Height; int count = Math.Min(tiles.Count, defaultTilesPerRow); requisition.Width = btnWidth + (int)space + 2 * (int)lineWidth + count * tileWidth + (count + 1) * tileSpacing + 2 * (int)BorderWidth; requisition.Height = Math.Max(tileHeight + 2 * (tileSpacing + (int)lineWidth), btnHeight) + 2 * (int)BorderWidth; if (WidthRequest != -1) { requisition.Width = WidthRequest; } if (HeightRequest != -1) { requisition.Height = HeightRequest; } }
protected override void OnSizeRequested(ref Requisition requisition) { base.OnSizeRequested(ref requisition); int lw, lh; lbl_layout.GetPixelSize(out lw, out lh); double frameSize = 2 * lineWidth + childPadding; barHeight = lh + 2 * space; if (expandButton != null && expandButton.Visible) { expandButton.SetSizeRequest(lh, lh); expandButton.SizeRequest(); } Requisition childRequisition = new Requisition(); if (Child != null && Child.Visible) { if (HeightRequest != -1) { int left = HeightRequest - (int)(2 * frameSize + barHeight); Child.HeightRequest = left; } if (WidthRequest != -1) { int left = WidthRequest - (int)(2 * frameSize); Child.WidthRequest = left; } childRequisition = Child.SizeRequest(); } if (WidthRequest == -1) { if (Child != null && Child.Visible) { requisition.Width = childRequisition.Width + (int)(2 * frameSize); } else { requisition.Width = lw + (int)(2 * (2 * lineWidth + space)); if (expandButton != null && expandButton.Visible) { requisition.Width += expandButton.WidthRequest + (int)space; } } } if (HeightRequest == -1) { requisition.Height = (int)(2 * frameSize + barHeight); if (Child != null && Child.Visible) { requisition.Height += childRequisition.Height; } } }