Esempio n. 1
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.checkedItems = new DropDownCheckedItemsCollection(this);
            RadCheckedListDataItemCollection dataItemCollection = new RadCheckedListDataItemCollection(this, this.ListElement.DataLayer, this.ListElement);

            this.checkAllItem                                      = new CheckAllDataItem("Check All", this);
            this.checkAllItem.Owner                                = this.ListElement;
            this.ListElement.DataLayer.Items                       = (RadListDataItemCollection)dataItemCollection;
            this.ListElement.Items                                 = (IList <RadListDataItem>)dataItemCollection;
            this.checkedItemTraverser                              = new CheckedItemTraverser((IList <RadListDataItem>)dataItemCollection, this.checkAllItem, this.ShowCheckAllItems);
            this.ListElement.ViewElement.DataProvider              = (IEnumerable)this.checkedItemTraverser;
            this.ListElement.Scroller.Traverser                    = (ITraverser <RadListDataItem>) this.checkedItemTraverser;
            this.ListElement.SelectionMode                         = SelectionMode.One;
            this.ListElement.DataLayer.DataView.CollectionChanged += new NotifyCollectionChangedEventHandler(this.DataView_CollectionChanged);
            this.autoCompleteEditableAreaElement.AutoCompleteTextBox.AutoCompleteDataSource = (object)dataItemCollection;
            this.autoCompleteEditableAreaElement.AutoCompleteTextBox.AutoCompleteMode       = AutoCompleteMode.SuggestAppend;
            this.ListElement.ViewElement.ElementProvider = (IVirtualizedElementProvider <RadListDataItem>) new CheckedDropDownListElementProvider(this.ListElement);
            this.WireAutoCompleteEvents();
            this.Children[2].MinSize = new Size(0, 18);
        }
Esempio n. 2
0
        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));
        }