/// <include file='doc\PagedControl.uex' path='docs/doc[@for="PagedControl.PaginateRecursive"]/*' /> public override void PaginateRecursive(ControlPager pager) { int itemCount = IsCustomPaging ? ItemCount : InternalItemCount; int itemsPerPage = ItemsPerPage; _itemPager = pager.GetItemPager(this, itemCount, itemsPerPage, GetItemWeight()); }
internal static void DoPaginateChildren(ControlPager pager, Control ctl, ref int firstAssignedPage) { if (ctl.HasControls()) { foreach (Control child in ctl.Controls) { if (child.Visible) { MobileControl mobileCtl = child as MobileControl; if (mobileCtl != null) { mobileCtl.PaginateRecursive(pager); if (firstAssignedPage == -1) { firstAssignedPage = mobileCtl.FirstPage; } } else if (child is UserControl) { DoPaginateChildren(pager, child, ref firstAssignedPage); } } } } }
public virtual void PaginateRecursive(ControlPager pager) { if (!EnablePagination) { return; } if (PaginateChildren || this.Form.ControlToPaginate == this) { int firstAssignedPage = -1; DoPaginateChildren(pager, this, ref firstAssignedPage); if (firstAssignedPage != -1) { this.FirstPage = firstAssignedPage; } else { this.FirstPage = pager.GetPage(GetVisibleWeight()); } this.LastPage = pager.PageCount; } else { int pageNumber = pager.GetPage(GetVisibleWeight()); SetControlPageRecursive(this, pageNumber); this.FirstPage = pageNumber; this.LastPage = pageNumber; } }
/// <include file='doc\Panel.uex' path='docs/doc[@for="Panel.PaginateRecursive"]/*' /> public override void PaginateRecursive(ControlPager pager) { if (!EnablePagination) { return; } if (Paginate && Content != null) { Content.Paginate = true; Content.PaginateRecursive(pager); this.FirstPage = Content.FirstPage; this.LastPage = pager.PageCount; } else { base.PaginateRecursive(pager); } }
/// <include file='doc\TextView.uex' path='docs/doc[@for="TextView.PaginateRecursive"]/*' /> public override void PaginateRecursive(ControlPager pager) { BuildContents(); base.PaginateRecursive(pager); }
/// <include file='doc\ItemPager.uex' path='docs/doc[@for="ItemPager.ItemPager1"]/*' /> public ItemPager(ControlPager pager, MobileControl control, int itemCount, int itemsPerPage, int itemWeight) { _control = control; if (itemsPerPage > 0) { // User-specified pagination behavior, always given // number of items per page. if (itemCount < itemsPerPage) { _firstPageItemCount = itemCount; _firstPage = _lastPage = pager.GetPage(itemCount * itemWeight); } else { int numberOfPages = (itemCount - 1) / itemsPerPage + 1; _firstPageItemCount = itemsPerPage; _fullPageItemCount = itemsPerPage; _lastPageItemCount = itemCount - (numberOfPages - 1) * itemsPerPage; _firstPage = pager.GetPage(itemsPerPage * itemWeight); pager.PageCount += numberOfPages - 1; if (numberOfPages > 1) { pager.RemainingWeight = Math.Max(0, pager.PageWeight - _lastPageItemCount * itemWeight); } _lastPage = _firstPage + numberOfPages - 1; } } else { int totalItemWeight = itemCount * itemWeight; if (totalItemWeight <= pager.RemainingWeight) { _firstPageItemCount = itemCount; _firstPage = _lastPage = pager.GetPage(totalItemWeight); } else { _firstPageItemCount = pager.RemainingWeight / itemWeight; int remainingItemCount = itemCount - _firstPageItemCount; _fullPageItemCount = Math.Max(1, pager.PageWeight / itemWeight); int fullPageCount = remainingItemCount / _fullPageItemCount; _lastPageItemCount = remainingItemCount % _fullPageItemCount; _firstPage = pager.PageCount; // increment for first page pager.PageCount++; pager.RemainingWeight = pager.PageWeight; // increment for full pages pager.PageCount += fullPageCount; // remove remaining weight for last page pager.RemainingWeight -= _lastPageItemCount * itemWeight; // correct if first page is empty if (_firstPageItemCount == 0) { _firstPage++; _firstPageItemCount = Math.Min(_fullPageItemCount, itemCount); } // correct if last page is empty if (_lastPageItemCount == 0) { pager.PageCount--; _lastPageItemCount = Math.Min(_fullPageItemCount, itemCount); pager.RemainingWeight = 0; } _lastPage = pager.PageCount; } } _control.FirstPage = _firstPage; _control.LastPage = _lastPage; }
/// <include file='doc\Form.uex' path='docs/doc[@for="Form.PaginateRecursive"]/*' /> public override void PaginateRecursive(ControlPager pager) { _pageCount = PaginateForm(); }
private int PaginateForm() { int pageWeight = MobilePage.Adapter.OptimumPageWeight; if (Header != null) { pageWeight -= Header.VisibleWeight; } if (Footer != null) { pageWeight -= Footer.VisibleWeight; } if (pageWeight <= 0) { // pageWeight = MobilePage.Adapter.OptimumPageWeight / 2; } if (IsFormPaginationAllowed()) { if ((Paginate) || (ControlToPaginate == this)) { ControlPager pager = new ControlPager(this, pageWeight); base.PaginateRecursive(pager); return pager.PageCount; } else if(ControlToPaginate != null) { ControlPager pager = new ControlPager(this, pageWeight); SetControlPage(1); Control control = ControlToPaginate; MobileControl ctp = control as MobileControl; if(ctp != null) { ctp.PaginateRecursive(pager); } else { int firstAssignedPage = -1; DoPaginateChildren(pager, control, ref firstAssignedPage); } while(control != this) { MobileControl mc = control as MobileControl; if(mc != null) { if(mc is Form) { throw(new Exception(SR.GetString(SR.Form_InvalidControlToPaginateForm))); } if (mc.FirstPage > ctp.FirstPage) { mc.FirstPage = ctp.FirstPage; } if(mc.LastPage < ctp.LastPage) { mc.LastPage = ctp.LastPage; } } control = control.Parent; } this.LastPage = Math.Max(pager.PageCount, 1); if(Header != null) { SetEnablePaginationRecursive(Header, false); } if(Footer != null) { SetEnablePaginationRecursive(Footer, false); } return this.LastPage; } } return 1; }
/// <include file='doc\MobileControl.uex' path='docs/doc[@for="MobileControl.PaginateRecursive"]/*' /> public virtual void PaginateRecursive(ControlPager pager) { if (!EnablePagination) { return; } if (PaginateChildren || this.Form.ControlToPaginate == this) { int firstAssignedPage = -1; DoPaginateChildren(pager, this, ref firstAssignedPage); if (firstAssignedPage != -1) { this.FirstPage = firstAssignedPage; } else { this.FirstPage = pager.GetPage(GetVisibleWeight()); } this.LastPage = pager.PageCount; } else { int pageNumber = pager.GetPage(GetVisibleWeight()); SetControlPageRecursive(this, pageNumber); this.FirstPage = pageNumber; this.LastPage = pageNumber; } }
private int PaginateForm() { int pageWeight = MobilePage.Adapter.OptimumPageWeight; if (Header != null) { pageWeight -= Header.VisibleWeight; } if (Footer != null) { pageWeight -= Footer.VisibleWeight; } if (pageWeight <= 0) { // pageWeight = MobilePage.Adapter.OptimumPageWeight / 2; } if (IsFormPaginationAllowed()) { if ((Paginate) || (ControlToPaginate == this)) { ControlPager pager = new ControlPager(this, pageWeight); base.PaginateRecursive(pager); return(pager.PageCount); } else if (ControlToPaginate != null) { ControlPager pager = new ControlPager(this, pageWeight); SetControlPage(1); Control control = ControlToPaginate; MobileControl ctp = control as MobileControl; if (ctp != null) { ctp.PaginateRecursive(pager); } else { int firstAssignedPage = -1; DoPaginateChildren(pager, control, ref firstAssignedPage); } while (control != this) { MobileControl mc = control as MobileControl; if (mc != null) { if (mc is Form) { throw(new Exception(SR.GetString(SR.Form_InvalidControlToPaginateForm))); } if (mc.FirstPage > ctp.FirstPage) { mc.FirstPage = ctp.FirstPage; } if (mc.LastPage < ctp.LastPage) { mc.LastPage = ctp.LastPage; } } control = control.Parent; } this.LastPage = Math.Max(pager.PageCount, 1); if (Header != null) { SetEnablePaginationRecursive(Header, false); } if (Footer != null) { SetEnablePaginationRecursive(Footer, false); } return(this.LastPage); } } return(1); }