Binding to QueryableDataServiceCollectionView not working

2 posts, 0 answers
  1. DMC Helpdesk
    DMC Helpdesk avatar
    52 posts
    Member since:
    Nov 2007

    Posted 31 Jul 2012 Link to this post

    Hi,

    I am trying to use QueryableDataServiceCollectionView in my Prism based application.My view model is working fine when binding to DataServiceCollection or DataServiceQuery ,but now I want to gain more control over paging,filtering,sorting,and saving data,so I switched to QueryableDataServiceCollectionView.I changed my view model binding property "DataItems" from DataServiceCollection<T> to  QueryableDataServiceCollectionView<T> and now I see the whole data records returned though the pagesize on my QueryableDataServiceCollectionView and on my DataPager is 20.

    The grid display 41 records in page 1 and 3 paging buttons [1 2 3].The paging becomes normal (20 records per page) once I click on page1, page 2, or page 3.I checked fiddler and found that the data service query for the first loading lacks the '$top=20' parameter

    view.ViewModel.DataItem = new Telerik.Windows.Data.QueryableDataServiceCollectionView<User>(db, db.Users){  AutoLoad = true,PageSize=20};


    <telerik:RadGridView    ItemsSource="{Binding PagedSource, ElementName=DataPager1}"  >

    <telerik:RadDataPager  Name="DataPager1" Source="{Binding DataItem}"   PageSize="20" DisplayMode="Numeric">


    Environment:
    VS 2010
    .NET 4 + WCF
    EF 4
    Telerik WPF  2012_2_0725 Trial Version


    Thanks in advance
  2. DMC Helpdesk
    DMC Helpdesk avatar
    52 posts
    Member since:
    Nov 2007

    Posted 31 Jul 2012 Link to this post

    The solution is to set page size outside the constructor,otherwise it gets ignored.

    view.ViewModel.DataItem = new Telerik.Windows.Data.QueryableDataServiceCollectionView<User>(db, db.Users);
     view.ViewModel.DataItem.PageSize = 20;
    view.ViewModel.DataItem.AutoLoad = true;

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top