共用方式為


DataPager.PageIndex Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the index of the current page.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
<DefaultValueAttribute()> _
Public Property PageIndex As Integer
[DefaultValueAttribute()]
public int PageIndex { get; set; }
<sdk:DataPager PageIndex="int"/>

Property Value

Type: System.Int32
The index of the current page if the source is an IPagedCollectionView; otherwise, 0. The default is -1.

Exceptions

Exception Condition
ArgumentOutOfRangeException

Source is nulla null reference (Nothing in Visual Basic) or PageSize is 0, and PageIndex is not -1.

-or-

Source is not nulla null reference (Nothing in Visual Basic) or PageSize is not 0, and PageIndex is less than 0.

Remarks

Dependency property identifier field: PageIndexProperty

If Source is nulla null reference (Nothing in Visual Basic), or if PageSize is 0, PageIndex must be -1. Otherwise, PageIndex must be greater than or equal to 0.

The source typically implements the IPagedCollectionView interface. In this case, PageIndex gets or sets the current IPagedCollectionView.PageIndex of the IPagedCollectionView.

If the source is a collection that implements IEnumerable<T> but not IPagedCollectionView, PageIndex returns 0.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.