Exemple #1
0
        private void OverrideRemoveButtonClick(object sender, EventArgs e)
        {
            var selectedItems = (form.Controls.Find("listbox", true)[0] as ListBox).SelectedItems;

            if (selectedItems.Count > 0)
            {
                var listItemType = selectedItems[0].GetType();
                var valueProp    = listItemType.GetProperty("Value");
                var actualItems  = selectedItems.OfType <object>().Select(o => valueProp.GetValue(o)).ToList();
                foreach (var item in actualItems)
                {
                    CurrentItems.Remove(item);
                }
            }

            orgRemoveClickHandler.DynamicInvoke(sender, e);
        }