public void BindDataSource <T>(IList <T> list, string displayMember, string valueMember) where T : new()
        {
            List <LightObject> _list = new List <LightObject>();

            try
            {
                PropertyInfo textProp  = typeof(T).GetProperty(displayMember);
                PropertyInfo valueProp = typeof(T).GetProperty(valueMember);
                LightObject  obj;
                foreach (T _t in list)
                {
                    obj = new LightObject()
                    {
                        Text  = textProp.GetValue(_t, null).ToStr(),
                        Value = valueProp.GetValue(_t, null)
                    };
                    _list.Add(obj);
                }
                this.ObjList = _list;
                this.RefreshSource();
                this.SelectedIndex = -1;
            }
            catch (Exception)
            {
                throw;
            }
        }
 public void BindDataSource(DataTable dt, string displayMember, string valueMember)
 {
     try
     {
         List <LightObject> _list = new List <LightObject>();
         LightObject        obj;
         foreach (DataRow rw in dt.Rows)
         {
             obj = new LightObject(rw[displayMember].ToStr(), rw[valueMember]);
             _list.Add(obj);
         }
         this.ObjList = _list;
         this.RefreshSource();
         this.SelectedIndex = -1;
     }
     catch (Exception)
     {
         throw;
     }
 }
 /// <summary>
 /// Set Combobox İtems with given resource string and delimiter parameters.
 /// </summary>
 /// <param name="itemList">String Resource of ComboBox.</param>
 /// <param name="itemDelimiter">Key-Value Pairs delimiter char.</param>
 /// <param name="propDelimiter">Delimiter char between Key and Value.</param>
 public void SetItemSource(string itemList, char itemDelimiter, char propDelimiter)
 {
     if (itemList.IsNullOrSpace() ||
         Char.ToString(itemDelimiter).IsNullOrEmpty() ||
         Char.ToString(propDelimiter).IsNullOrEmpty())
     {
         return;
     }
     else
     {
         try
         {
             string[]    itemsSrc = itemList.Split(itemDelimiter);
             string[]    strarr;
             LightObject _op;
             foreach (string item in itemsSrc)
             {
                 strarr = item.Split(propDelimiter);
                 if (strarr != null)
                 {
                     if (strarr.Length == 2)
                     {
                         _op = new LightObject {
                             Text = strarr[0], Value = strarr[1]
                         };
                         ObjList.Add(_op);
                     }
                 }
             }
         }
         catch (Exception)
         {
             this.ObjList = new List <LightObject>();
         }
         finally
         {
             this.RefreshSource();
             this.SelectedIndex = -1;
         }
     }
 }
        public void BindDataSource(Hashtable h)
        {
            List <LightObject> list = new List <LightObject>();

            try
            {
                IDictionaryEnumerator iDict = h.GetEnumerator();
                LightObject           obj;
                while (iDict.MoveNext())
                {
                    obj = new LightObject(iDict.Key.ToStr(), iDict.Value);
                    list.Add(obj);
                }
                this.ObjList = list;
                this.RefreshSource();
                this.SelectedIndex = -1;
            }
            catch (Exception)
            {
                throw;
            }
        }