Esempio n. 1
0
        /// <summary>
        /// Sorts the collection in memory.
        /// </summary>
        public GenericListItemCollection Sort(string orderBy)
        {
            GenericListItemCollection         list     = this;
            DynamicComparer <GenericListItem> comparer = new DynamicComparer <GenericListItem>(orderBy);

            list.Sort(comparer.Compare);

            return(list);
        }
Esempio n. 2
0
        public void Load(GenericListItemCollection coll)
        {
            _list = coll;
            if (_addBlankRow)
            {
                _list.Insert(0, new GenericListItem("", _blankRowText, ""));
            }

            this.Properties.Items.Clear();
            this.Properties.Items.AddRange(_list);
        }
Esempio n. 3
0
        //protected override void ProcessFindItem(KeyPressHelper helper, char pressedKey)
        //{
        //    //base.ProcessFindItem(helper, pressedKey);
        //    if (Properties.ReadOnly) return;
        //    string searchText = AutoSearchText;
        //    int itemIndex = FindItem(searchText, 0);
        //    bool isOpened = IsPopupOpen;
        //    if (IsImmediatePopup)
        //    {
        //        DoImmediatePopup(itemIndex, pressedKey);
        //        if (!isOpened && IsPopupOpen)
        //        {
        //            itemIndex = FindItem(searchText, 0);
        //        }
        //    }
        //    if (IsPopupOpen)
        //    {
        //        FindUpdatePopupSelectedItem(itemIndex);
        //    }
        //    if (itemIndex != -1)
        //    {
        //        FindUpdateEditValue(itemIndex, false);
        //        if (IsMaskBoxAvailable)
        //        {
        //            UpdateMaskBoxDisplayText();
        //            //SelectionStart = selectionStart;
        //            //SelectionLength = Text.Length - selectionStart;
        //            SelectionStart = helper.SelectionStart;
        //            SelectionLength = Text.Length - helper.SelectionStart;
        //        }
        //    }
        //    else
        //    {
        //        if (IsMaskBoxAvailable)
        //        {
        //            FindUpdateEditValueAutoSearchText();
        //            UpdateMaskBoxDisplayText();
        //            //SelectionStart = Math.Max(0, selectionStart);
        //            SelectionStart = Math.Max(0, helper.SelectionStart);
        //            SelectionLength = 0;
        //        }
        //        else
        //        {
        //            AutoSearchText = (AutoSearchText.Length > 1 ? AutoSearchText.Substring(0, AutoSearchText.Length - 1) : string.Empty);
        //        }
        //    }
        //    LayoutChanged();
        //}

        //public void Load(SupportDropDown ddType)
        //{
        //    _dropDownType = ddType;
        //    DataTable dt = Utils.GetDataTableBasedOnDropDownType(_dropDownType);

        //    GenericListItemCollection coll = new GenericListItemCollection();
        //    foreach (DataRow row in dt.Rows)
        //    {
        //        coll.Add(new GenericListItem((row[0] != DBNull.Value ? row[0].ToString() : ""),
        //            (row[1] != DBNull.Value ? row[1].ToString() : ""),
        //            (dt.Columns.Count > 2 && row[2] != DBNull.Value ? row[2].ToString() : "")));
        //    }
        //    Load(coll);
        //}

        public void Load(List <string> list)
        {
            GenericListItemCollection coll = new GenericListItemCollection();

            foreach (string s in list)
            {
                coll.Add(new GenericListItem(s, s, s));
            }

            Load(coll);
        }
Esempio n. 4
0
        public void Load(DataTable dt)
        {
            GenericListItemCollection coll = new GenericListItemCollection();

            foreach (DataRow row in dt.Rows)
            {
                coll.Add(new GenericListItem((row[0] != DBNull.Value ? row[0].ToString() : ""),
                                             (row[1] != DBNull.Value ? row[1].ToString() : ""),
                                             (dt.Columns.Count > 2 && row[2] != DBNull.Value ? row[2].ToString() : "")));
            }
            Load(coll);
        }