Example #1
0
            public void RemoveAt(int index)
            {
                _owner.CheckNoDataSource();

                if (index < 0 || index >= Count)
                {
                    throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index));
                }

                if (_owner.IsHandleCreated)
                {
                    _owner.NativeRemoveAt(index);
                }

                _ownerComboBoxAccessibleObject.ItemAccessibleObjects.Remove(InnerList[index]);
                InnerList.RemoveAt(index);

                if (!_owner.IsHandleCreated && index < _owner._selectedIndex)
                {
                    _owner._selectedIndex--;
                }

                if (_owner.AutoCompleteSource == AutoCompleteSource.ListItems)
                {
                    _owner.SetAutoComplete(false, false);
                }
            }