0

I am using a datagrid which is binded to an observable collection. The grid is divided into pages and each page holds 50 records. Initially, only first 3 pages load and then on user scroll remaining pages start loading data.

The problem is when I click on column header to sort data, the data of only first page sorts even if there is data for first 2 pages. And when I again click on column header then all 100 rows i.e. data for both the pages are sorted instead of just the first page. Thank-you!

1 Answer 1

1

This is how I have done DataGrid column header sorting in my application-

<dgCP:DataGridTemplateColumn  SortMemberPath="CompleteDate" Header="Complete Date" CanUserSort="true">
            <dgCP:DataGridTemplateColumn.CellTemplate >
                    <DataTemplate>
                        <TextBlock>
                            <TextBlock.Text>
                                <Binding Path="CompleteDate"  StringFormat="{}{0:MM/dd/yyyy}"/>
                            </TextBlock.Text>
                        </TextBlock>
                    </DataTemplate>
                </dgCP:DataGridTemplateColumn.CellTemplate>
            </dgCP:DataGridTemplateColumn>

see if this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried this but this does not solve my problem. The datagrid sorts all rows until I scroll till the end of the grid. Maybe the problem is because of setting "EnableRowVirtualization" to true. If this property is set to false then the performance of loading rows is impacted so i had to set it to true only but then sorting does not works. Is there any other way, please suggest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.