Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4970
How to get the whole row count of datasource of xamGrid for databinding?
posted

I want to bind the count of datasource(itemsource) for xamGrid in Page style. So tried in this way:

Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Cell.Row.Manager.Rows.Count}"

but that is the number of rows in one page, same as pagesize, not the total count of datasource.

What's the right path for this case?

Or if xamGrid dataContext is viewmodel which has a property say TotalCount, how to bind it to a textbox in PageStyle?

Parents
No Data
Reply
  • 30945
    Suggested Answer
    Offline posted

     

    Hello,

     

    I have tested the sample application that I attached with my previous post with PagedCollectionView and it seems to work as it supposed to. The Count property of the PagedCollectionView gets the amount of the records which are currently in view. When I change the items source of my application to PagedCollecitonVeiw and use the binding you mentioned I get “20” in the TextBlock. In order to show the count of all the records you can use TotalItemCount property instead. The TextBlock will look like this:

     

        <TextBlock

            HorizontalAlignment="Left"

            VerticalAlignment="Center"

            FontSize="16"

            Text="{Binding

                    RelativeSource={RelativeSource TemplatedParent},

                    Path=Parent.Owner.Grid.ItemsSource.TotalItemCount,

                    StringFormat='There are {0:N0} Rows in the XamGrid'}"/>

     

     

    If you have any further questions please do not hesitate to ask.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

Children