Silverlight RadDataPager绑定

时间:2011-03-17 08:45:06

标签: silverlight telerik pager

我遇到来自Telerik的RadDataPager的问题......我可以在Gridview中显示我的所有用户,但是寻呼机没有在下一页上设置接下来的5个用户。他们只是站在我的第一页。

有人有什么想法吗?

这是我的代码

<telerik:RadGridView Grid.Column="0" Grid.Row="0" x:Name="RadGridView1" ItemsSource="{Binding CovrUsers}" IsReadOnly="True" DataContext="{Binding Source={StaticResource CovrUsersViewModel}}" AutoGenerateColumns="False" Margin="230,5,0,0"
                             ScrollMode="Deferred"
                             GridLinesVisibility="Horizontal"
                             IsSynchronizedWithCurrentItem="True" >

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="First name" DataMemberBinding="{Binding FirstName}" />
                <telerik:GridViewDataColumn Header="Last name" DataMemberBinding="{Binding LastName}" />
                <telerik:GridViewDataColumn Header="User name" DataMemberBinding="{Binding UserName}" />
                <telerik:GridViewDataColumn Header="Hourly rate" DataMemberBinding="{Binding HourlyRate}" />
                <telerik:GridViewDataColumn Header="Rights" DataMemberBinding="{Binding Rights.Description}"  />
            </telerik:RadGridView.Columns>



        </telerik:RadGridView>
            <telerik:RadDataPager PageSize="5" IsTotalItemCountFixed="True" x:Name="RadDataPager1" Grid.Row="0" Grid.Column="0" Source="{Binding CovrUsers,ElementName=RadGridView1}"  Margin="230,0,0,0" VerticalAlignment="Bottom" FontSize="11" />

请求帮助!!

1 个答案:

答案 0 :(得分:0)

我找到了答案。这很奇怪,但它有效:)

<telerik:RadGridView Grid.Column="0" Grid.Row="0" x:Name="RadGridView1" 
                             ItemsSource="{Binding CovrUsers}" 
                             IsReadOnly="True" 
                             DataContext="{Binding Source={StaticResource CovrUsersViewModel}}" 
                             AutoGenerateColumns="False" Margin="230,5,0,0"
                             ScrollMode="Deferred"
                             GridLinesVisibility="Horizontal"
                             IsSynchronizedWithCurrentItem="True" >

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="First name" DataMemberBinding="{Binding FirstName}" />
                <telerik:GridViewDataColumn Header="Last name" DataMemberBinding="{Binding LastName}" />
                <telerik:GridViewDataColumn Header="User name" DataMemberBinding="{Binding UserName}" />
                <telerik:GridViewDataColumn Header="Hourly rate" DataMemberBinding="{Binding HourlyRate}" />
                <telerik:GridViewDataColumn Header="Rights" DataMemberBinding="{Binding Rights.Description}"  />
            </telerik:RadGridView.Columns>

        </telerik:RadGridView>
            <telerik:RadDataPager 
                PageIndexChanging="RadDataPager_PageIndexChanging"
                PageSize="5" 
                IsTotalItemCountFixed="True" 
                x:Name="RadDataPager" 
                Grid.Row="0" Grid.Column="0" 
                Source="{Binding Path=Items,ElementName=RadGridView1}" 
                DataContext="{Binding Source={StaticResource CovrUsersViewModel}}" 
                Margin="230,0,0,0" 
                VerticalAlignment="Bottom" 
                FontSize="11"/>