protected override void UpdatePopupMinMaxSize(RadPopupControlBase popup) { if (this.DropDownMinSize != Size.Empty) { popup.MinimumSize = this.DropDownMinSize; } if (this.DropDownMaxSize != Size.Empty) { popup.MaximumSize = this.DropDownMaxSize; } if (!(popup.MinimumSize == Size.Empty)) { return; } RadSizablePopupControl sizablePopupControl = popup as RadSizablePopupControl; RadElement sizingGrip = (RadElement)sizablePopupControl.SizingGrip; Rectangle rectangle = new Rectangle(sizingGrip.BoundingRectangle.Location, Size.Add(sizingGrip.BoundingRectangle.Size, sizingGrip.Margin.Size)); float num = (float)((double)this.listElement.BorderWidth * 2.0 + (this.listElement.VScrollBar.Visibility == ElementVisibility.Visible ? (double)(this.listElement.VScrollBar.FirstButton.Size.Height + this.listElement.VScrollBar.SecondButton.Size.Height) : 0.0) + (sizablePopupControl.SizingGrip.Visibility == ElementVisibility.Collapsed ? 0.0 : (double)rectangle.Height)); if (this.maxDropDownItems != 0) { num = 0.0f; } popup.Size = new Size(0, (int)Math.Ceiling(this.listElement.Items.Count == 1 ? 0.0 : (double)num)); }
protected override void UpdatePopupMinMaxSize(RadPopupControlBase popup) { if (this.DropDownMinSize != Size.Empty) { popup.MinimumSize = this.DropDownMinSize; } if (this.DropDownMaxSize != Size.Empty) { popup.MaximumSize = this.DropDownMaxSize; } if (popup.MinimumSize == Size.Empty) { RadSizablePopupControl sizablePopup = popup as RadSizablePopupControl; Debug.Assert(sizablePopup != null, "Popup is not an RadSizablePopupControl"); float height = (this.listElement.BorderWidth * 2) + (this.listElement.VScrollBar.Visibility == ElementVisibility.Visible ? this.listElement.VScrollBar.FirstButton.Size.Height + this.listElement.VScrollBar.SecondButton.Size.Height : 0) + //this.listElement.HScrollBar.FullBoundingRectangle.Height + (sizablePopup.SizingGrip.Visibility == ElementVisibility.Collapsed ? 0: sizablePopup.SizingGrip.FullBoundingRectangle.Height); //TODO to be refactored - initialy the scroll bar of the list element is visible popup.MinimumSize = new Size(0, (int)Math.Ceiling(this.listElement.Items.Count == 1 ? 0 : height)); } }
//protected override Size GetInitialPopupSize() //{ // if (!this.IsInValidState(true)) // return Size.Empty; // int initialHeight = 0; // int visibleItemsCount = Math.Min(this.maxDropDownItems, this.listElement.Items.Count); // for (int i = 0; i < visibleItemsCount; i++) // { // SizeF desiredSize = this.listElement.Items[i].Height; // initialHeight += (int)desiredSize.Height; // } // return new Size(this.Size.Width, initialHeight); //} protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { RadSizablePopupControl sizablePopup = popup as RadSizablePopupControl; Debug.Assert(sizablePopup != null, "Popup is not an RadSizablePopupControl"); int itemsCount = this.listElement.Items.Count; if (itemsCount > defaultItemsCountInDropDown || itemsCount == 0) { itemsCount = defaultItemsCountInDropDown; } if (itemsCount > this.maxDropDownItems) { itemsCount = this.maxDropDownItems; } int sizingGripSize = 0; if (sizablePopup.SizingGrip.Visibility == ElementVisibility.Visible) { sizingGripSize = sizablePopup.SizingGrip.FullBoundingRectangle.Height; } int height = itemsCount * (this.ListElement.ItemHeight + this.listElement.Scroller.ItemSpacing) + sizingGripSize + //this.listElement.HScrollBar.FullBoundingRectangle.Height + (int)(this.listElement.BorderWidth * 2); return(new Size(this.Size.Width, height)); }
protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { RadSizablePopupControl sizablePopupControl = popup as RadSizablePopupControl; int num1 = this.listElement.Items.Count; CheckedItemTraverser traverser = this.listElement.Scroller.Traverser as CheckedItemTraverser; if (traverser != null && traverser.CheckAll) { ++num1; } if (num1 > this.defaultItemsCountInDropDown || num1 == 0) { num1 = this.defaultItemsCountInDropDown; } if (num1 > this.maxDropDownItems && this.maxDropDownItems > 0) { num1 = this.maxDropDownItems; } int num2 = 0; if (sizablePopupControl.SizingGrip.Visibility == ElementVisibility.Visible) { RadElement sizingGrip = (RadElement)sizablePopupControl.SizingGrip; num2 = new Rectangle(sizingGrip.BoundingRectangle.Location, Size.Add(sizingGrip.BoundingRectangle.Size, sizingGrip.Margin.Size)).Height; } int num3 = 0; if (!this.listElement.AutoSizeItems) { int num4 = this.listElement.ItemHeight; for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index) { if (this.listElement.Items[index] is DescriptionTextListDataItem || this.listElement.IsDescriptionText) { num4 *= 2; break; } } if (this.ListElement.DpiScaleFactor != this.Popup.OwnerElement.DpiScaleFactor) { num4 = TelerikDpiHelper.ScaleInt(num4, this.Popup.OwnerElement.DpiScaleFactor); } int height = num1 * (num4 + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0); if (this.DropDownHeight != 106) { height = this.DropDownHeight; } return(new Size(this.Size.Width, height)); } int height1; if (this.listElement.Items.Count > 0) { for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index) { num3 += (int)this.listElement.Items[index].MeasuredSize.Height + this.listElement.Scroller.ItemSpacing; } height1 = num3 + this.listElement.Scroller.ItemSpacing + num2 + this.listElement.HScrollBar.Size.Height + (int)((double)this.listElement.BorderWidth * 2.0); } else { height1 = num1 * (this.listElement.ItemHeight + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0); } if (this.DropDownHeight != 106) { height1 = this.DropDownHeight; } return(new Size(this.Size.Width, height1)); }