예제 #1
0
        /// <summary>
        /// 增加列表成员
        /// </summary>
        /// <param name="count">增加数量,默认1个</param>
        public void AddItems(int count = 1)
        {
            _Rows  += count;
            _Handle = _Rows - 1;

            var page = _Current;

            Refresh();

            if (_Current > page)
            {
                // 切换了页码需要重新加载数据
                CurrentPageChanged?.Invoke(this, new PageControlEventArgs(FocusedRowHandle));
            }
            else
            {
                TotalRowsChanged?.Invoke(this, new PageControlEventArgs(FocusedRowHandle));
            }
        }
예제 #2
0
        /// <summary>
        /// 减少列表成员
        /// </summary>
        /// <param name="count">减少数量,默认1个</param>
        public void RemoveItems(int count = 1)
        {
            _Rows -= count;
            if (_Handle >= _Rows)
            {
                _Handle = _Rows - 1;
            }

            var page = _Current;

            Refresh();

            if ((_Rows > 0 && _Handle < _PageSize * (_TotalPages - 1)) || _Current < page)
            {
                // 不是末页或切换了页码需要重新加载数据
                CurrentPageChanged?.Invoke(this, new PageControlEventArgs(FocusedRowHandle));
            }
            else
            {
                TotalRowsChanged?.Invoke(this, new PageControlEventArgs(FocusedRowHandle));
            }
        }