Compartilhar via


DomainDataSource.PageSize Property

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Gets or sets the number of items displayed on each page of the view returned from the Data and DataView properties, or 0 to disable paging.

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

Syntax

'Declaration
Public Property PageSize As Integer
    Get
    Set
'Usage
Dim instance As DomainDataSource
Dim value As Integer

value = instance.PageSize

instance.PageSize = value
public int PageSize { get; set; }
public:
property int PageSize {
    int get ();
    void set (int value);
}
member PageSize : int with get, set
function get PageSize () : int
function set PageSize (value : int)

Property Value

Type: System.Int32
The number of items displayed on each page of the view returned from the Data and DataView properties, or 0 to indicate there is no paging.

Remarks

When PageSize equals 0, paging is turned off and the number of items exposed by the Data property is unlimited. When PageSize is a non-zero value, the number of entities loaded with each Load operation is limited as well, using server-side paging. When PageSize and LoadSize are both non-zero, entities will be loaded using the multiple of PageSize nearest LoadSize. This allows multiple pages to be loaded at once without loading partial pages.

Always specify a value for PageSize that is less than or equal to any ResultLimit property configured on the DomainDataSource.

Examples

The following example shows a DomainDataSource control with the LoadSize property set to 30 and PageSize property set to 15.

<Grid x:Name="LayoutRoot" Background="White">  
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <riaControls:DomainDataSource PageSize="15" LoadSize="30" x:Name="source" QueryName="GetProducts" AutoLoad="true">
        <riaControls:DomainDataSource.DomainContext>
            <domain:ProductDomainContext />
        </riaControls:DomainDataSource.DomainContext>
        <riaControls:DomainDataSource.SortDescriptors>
            <riaData:SortDescriptor PropertyPath="ListPrice" />
        </riaControls:DomainDataSource.SortDescriptors>
    </riaControls:DomainDataSource>
    <data:DataGrid Grid.Row="0" ItemsSource="{Binding Data, ElementName=source}" />
    <data:DataPager Grid.Row="1" Source="{Binding Data, ElementName=source}" />
</Grid>

See Also

Reference

DomainDataSource Class

System.Windows.Controls Namespace

LoadSize

Other Resources

DomainDataSource