Example #1
0
 /// <summary>
 /// Sets the ItemData property of a specific list control.
 /// </summary>
 /// <param name="lstControl">The list control.</param>
 /// <param name="itemsData">The Item data list to set.</param>
 public void SetItemData(System.Windows.Forms.ListControl lstControl, int[] itemsData)
 {
     if (lstControl is System.Windows.Forms.ComboBox)
     {
         SetItemData((System.Windows.Forms.ComboBox)lstControl, itemsData);
     }
     else
     {
         SetItemData((System.Windows.Forms.ListBox)lstControl, itemsData);
     }
 }
Example #2
0
        public static int GetItemData(this System.Windows.Forms.ListControl lstControl, int index)
#endif
        {
            if (lstControl is System.Windows.Forms.ComboBox)
            {
                return(GetItemData((System.Windows.Forms.ComboBox)lstControl, index));
            }
            else
            {
                return(GetItemData((System.Windows.Forms.ListBox)lstControl, index));
            }
        }
Example #3
0
        public static void RemoveItem(this System.Windows.Forms.ListControl lstControl, int index)
#endif
        {
            if (lstControl is System.Windows.Forms.ListBox)
            {
                RemoveItem((System.Windows.Forms.ListBox)lstControl, index);
            }
            else if (lstControl is System.Windows.Forms.ComboBox)
            {
                RemoveItem((System.Windows.Forms.ComboBox)lstControl, index);
            }
        }
Example #4
0
        public static int GetNewIndex(this System.Windows.Forms.ListControl lstControl)
#endif
        {
            if (_dictionaryOfNewIndexes.ContainsKey(lstControl.GetHashCode()))
            {
                return(_dictionaryOfNewIndexes[lstControl.GetHashCode()]);
            }
            else
            {
                return(-1);
            }
        }
Example #5
0
        public static void AddItem(this System.Windows.Forms.ListControl lstControl, string value)
#endif
        {
            if (lstControl is System.Windows.Forms.ListBox)
            {
                AddItem((System.Windows.Forms.ListBox)lstControl, value);
            }
            else if (lstControl is System.Windows.Forms.ComboBox)
            {
                AddItem((System.Windows.Forms.ComboBox)lstControl, value);
            }
        }
Example #6
0
        public static void SetListItem(this System.Windows.Forms.ListControl lstControl, int index, string value)
#endif
        {
            if (lstControl is System.Windows.Forms.ComboBox)
            {
                SetListItem((System.Windows.Forms.ComboBox)lstControl, index, value);
            }
            else
            {
                SetListItem((System.Windows.Forms.ListBox)lstControl, index, value);
            }
        }
Example #7
0
        public static void SetItemData(this System.Windows.Forms.ListControl lstControl, int index, int value)
#endif
        {
            if (lstControl is System.Windows.Forms.ListBox)
            {
                SetItemData((System.Windows.Forms.ListBox)lstControl, index, value);
            }
            else if (lstControl is System.Windows.Forms.ComboBox)
            {
                SetItemData((System.Windows.Forms.ComboBox)lstControl, index, value);
            }
        }
Example #8
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        public static void Clear(this System.Windows.Forms.ListControl lstControl)
#endif
        {
            if (lstControl is System.Windows.Forms.ListBox)
            {
                ((System.Windows.Forms.ListBox)lstControl).Items.Clear();
            }
            else if (lstControl is System.Windows.Forms.ComboBox)
            {
                ((System.Windows.Forms.ComboBox)lstControl).Items.Clear();
            }
            _dictionaryOfNewIndexes[lstControl.GetHashCode()] = -1;
        }
Example #9
0
        /// <summary>
        /// Gets the ItemData property of a specific list control.
        /// </summary>
        /// <param name="lstControl">The list control to test.</param>
        /// <returns>Returns an int array with the item data list of the control.</returns>
        public int[] GetItemData(System.Windows.Forms.ListControl lstControl)
        {
            int[] res = new int[0];

            if (lstControl is System.Windows.Forms.ComboBox)
            {
                res = GetItemData((System.Windows.Forms.ComboBox)lstControl);
            }
            else
            {
                res = GetItemData((System.Windows.Forms.ListBox)lstControl);
            }

            return(res);
        }
Example #10
0
 public static void RefreshData(this System.Windows.Forms.ListControl list)
 {
     System.Windows.Forms.CurrencyManager myCurrencyManager = (System.Windows.Forms.CurrencyManager)list.BindingContext[list.DataSource];
     myCurrencyManager.Refresh();
 }
Example #11
0
        /// <summary>
        /// Removes the item.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <param name="index">The index.</param>
#if TargetF2
        public static void RemoveItem(System.Windows.Forms.ListControl lstControl, int index)
Example #12
0
        /// <summary>
        /// Gets the new index.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <returns></returns>
#if TargetF2
        public static int GetNewIndex(System.Windows.Forms.ListControl lstControl)
Example #13
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <param name="value">The value.</param>
#if TargetF2
        public static void AddItem(System.Windows.Forms.ListControl lstControl, string value)
Example #14
0
        /// <summary>
        /// Sets the item data.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
#if TargetF2
        public static void SetItemData(System.Windows.Forms.ListControl lstControl, int index, int value)
Example #15
0
 public static void List(System.Windows.Forms.ListControl control, List <Binding> src)
 {
     control.DisplayMember = "Key";
     control.ValueMember   = "Value";
     control.DataSource    = src;
 }
Example #16
0
        /// <summary>
        /// Gets the item data.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <param name="index">The index.</param>
        /// <returns></returns>
#if TargetF2
        public static int GetItemData(System.Windows.Forms.ListControl lstControl, int index)
Example #17
0
        /// <summary>
        /// Sets the list item.
        /// </summary>
        /// <param name="lstControl">The list control instance.</param>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
#if TargetF2
        public static void SetListItem(System.Windows.Forms.ListControl lstControl, int index, string value)
Example #18
0
        /// <summary>
        /// Gets the list item.
        /// </summary>
        /// <param name="lstControl">The List control instance.</param>
        /// <param name="index">The index.</param>
        /// <returns></returns>
#if TargetF2
        public static string GetListItem(System.Windows.Forms.ListControl lstControl, int index)
Example #19
0
 public static void List(System.Windows.Forms.ListControl control, Object[] src)
 {
     control.DisplayMember = "Key";
     control.ValueMember   = "Value";
     control.DataSource    = Bind.FromArray(src);
 }