/// <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); } }
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)); } }
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); } }
public static int GetNewIndex(this System.Windows.Forms.ListControl lstControl) #endif { if (_dictionaryOfNewIndexes.ContainsKey(lstControl.GetHashCode())) { return(_dictionaryOfNewIndexes[lstControl.GetHashCode()]); } else { return(-1); } }
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); } }
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); } }
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); } }
/// <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; }
/// <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); }
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(); }
/// <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)
/// <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)
/// <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)
/// <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)
public static void List(System.Windows.Forms.ListControl control, List <Binding> src) { control.DisplayMember = "Key"; control.ValueMember = "Value"; control.DataSource = src; }
/// <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)
/// <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)
/// <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)
public static void List(System.Windows.Forms.ListControl control, Object[] src) { control.DisplayMember = "Key"; control.ValueMember = "Value"; control.DataSource = Bind.FromArray(src); }