/// <summary> /// 维护当前分页控件显示的页码数据 /// </summary> /// <param name="addSubtract"></param> private void _MaintainCurrentPagers(AddSubtract addSubtract) { if (addSubtract == AddSubtract.Add) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] + 1; } } if (addSubtract == AddSubtract.subtract) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] - 1; } } }
/// <summary> /// Maintain page number data displayed by current paging control - single page switching /// </summary> /// <param name="addSubtract"></param> private void _MaintainCurrentPagersSingle(AddSubtract addSubtract) { if (addSubtract == AddSubtract.Add && CurrentPage < PageCount) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] + 1; } } if (addSubtract == AddSubtract.subtract && CurrentPage > 1) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] - 1; } } }
private void _RefreshPager(AddSubtract addSubtract) { /* * 1、默认分页的按钮为7个 * 2、当分页总数小于等于7时,直接显示1-7个分页按钮 * 3、当分页总数大于7时,显示当时为1、2、3、4、5、...、999(999为总页数) * 4、 * **/ if (this.PART_Content.Children.Count > 0) { int _index = 0; // int _contentCount = this.PART_Content.Children.Count; if (this.mCurrentIsAddEllipsisCtrl) //当前包含前缀省略号控件 { _index = 1; _contentCount = _contentCount - 1; } for (int i = 0; i < _contentCount - 2; i++) { var misLinkBtn = this.PART_Content.Children[_index] as MISLinkButton; if (misLinkBtn != null) { misLinkBtn.Content = addSubtract == AddSubtract.Add ? (Convert.ToInt32(misLinkBtn.Content) + 1).ToString() : (Convert.ToInt32(misLinkBtn.Content) - 1).ToString(); } _index++; } if (addSubtract == AddSubtract.Add) { //设置倒数第一个按钮会选中状态 this.PART_Content.Children[_index - 2].Focus(); } else { //设置第二个按钮会选中状态 if (this.mCurrentIsAddEllipsisCtrl) { this.PART_Content.Children[2].Focus(); } else { this.PART_Content.Children[1].Focus(); } } } }
private void _RefreshSinglePager(AddSubtract addSubtract) { if (this.PART_Content.Children.Count > 0) { int _index = 0; // int _contentCount = this.PART_Content.Children.Count; for (int i = 0; i < _contentCount; i++) { var pageNumBtn = this.PART_Content.Children[_index] as Button; if (pageNumBtn != null) { if (PageCount > CurrentPage) { pageNumBtn.Content = addSubtract == AddSubtract.Add ? (Convert.ToInt32(pageNumBtn.Content) + 1).ToString() : (Convert.ToInt32(pageNumBtn.Content) - 1).ToString(); } } _index++; } } }
/// <summary> /// Maintain the page number data displayed by the current paging control - jump page switch /// </summary> /// <param name="addSubtract"></param> private void _MaintainCurrentPagersGoto(AddSubtract addSubtract) { int _firstIndex = this.mCurrentPagers.First(); int _lastIndex = this.mCurrentPagers.Last(); if (addSubtract == AddSubtract.Add && CurrentPage <= PageCount) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] + GotoPageNum - _lastIndex + 1; } } if (addSubtract == AddSubtract.subtract && CurrentPage >= 1) { for (int i = 0; i < this.mCurrentPagers.Count; i++) { this.mCurrentPagers[i] = this.mCurrentPagers[i] - _lastIndex + GotoPageNum + PageNumber - 2; } } }
private void _RefreshGotoPager(AddSubtract addSubtract) { if (this.PART_Content.Children.Count > 0) { int _index = 0; int _contentCount = this.PART_Content.Children.Count; int _lastIndex = this.mCurrentPagers.Last(); for (int i = 0; i < _contentCount; i++) { var pageNumBtn = this.PART_Content.Children[_index] as Button; if (pageNumBtn != null) { if (PageCount >= CurrentPage) { pageNumBtn.Content = addSubtract == AddSubtract.Add ? (Convert.ToInt32(pageNumBtn.Content) + GotoPageNum - _lastIndex + 1).ToString() : (Convert.ToInt32(pageNumBtn.Content) - _lastIndex + GotoPageNum + PageNumber - 2).ToString(); } } _index++; } } }