ListBoxControl 删除选择的项的方法

 public void RemoveSelectItems<T>(BaseListBoxControl listControl)
        {
            var list = listControl.DataSource as List<T>;
            var selectItems = ((ListBoxControl) (listControl)).SelectedItems;
            foreach (var Item in selectItems)
            {
                list.Remove((T)Item);
            }
            listControl.DataSource = null;
            listControl.DataSource = list;

        }

你可能感兴趣的:(listbox)