private void UpdateItemsBox() { for (int i = ItemsBox.Items.Count - 1; i >= 0; i--) { ItemsBox.Items.RemoveAt(i); } for (int i = 0; i < data.GetItems().Count(); i++) { BudgetCalcItem item = data.GetItems().ElementAt(i).Value; ItemsBox.Items.Add(item.ItemName); ItemsBox.SetItemChecked(ItemsBox.Items.IndexOf(item.ItemName), item.Selected); } }
/// <summary> /// Constructor. /// </summary> /// /// <param name="Text"> . </param> /// <param name="Prompt"> . </param> /// <param name="Input"> . </param> /// <param name="Items"> The items. </param> /// <param name="CheckedItems"> The checked items. </param> public InputSelectDialog(String Text, String Prompt, String Input, IEnumerable <Object> Items, IEnumerable <Object> CheckedItems) : this(Text, Prompt, Input, Items) { for (Int32 i = 0; i < ItemsBox.Items.Count; i++) { ItemsBox.SetItemChecked(i, false); } foreach (Object item in CheckedItems) { Int32 ndx = ItemsBox.Items.IndexOf(item); ItemsBox.SetItemChecked(ndx, true); } }