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
605
Grouping when ItemsSource changes
posted

Hello.

I have a XamGrid with available grouping column. And AutoGeneratedColumns is false. ItemsSource binding on ViewModel's property.

I do next:

1. group XamGrid on some column.

2. change DataContext of XamGrid to null and then change DataContext on some other ViewModel. I expect that ItemsSource of XamGrid is changed and sorting and grouping options will not change.

But after changing DataContext there is no any grouped columns on XamGrid.

 

There is a bug? There is any workaround when grouping settings are not reset?

BR

Alexey Lukyanov

 

Parents
  • 21382
    Suggested Answer
    posted

    If you want to maintain the sort and grouping, you can use the persistence framework to save the layout of the grid to a memory stream, reset your data context, and then restore the sorting and grouping.

     

    When the .DataContext is cleared (or the ItemSource) the groupby / sorting settings are removed by design.

Reply Children