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
622
New record is not sorted
posted

Hello everybody,

I have a little problem using XamDataGrid and trying to find a quick solution.

I use MVVM pattern in WPF application. My view model has a bindingList as property  on wich a XamDataGrid is bound to.

When I add a new object in the BindingList within my view model, new record is well dispayed but whatever the sort direction of some columns, it is always displayed at the end of the grid.

Is it possible to force sort refresh of the data grid on record addition ? A solution without code-behind should be appreciate.

 

Thank's in advance.

Jean

 

  • 69686
    Verified Answer
    posted

    Hello Jean,

    You will need to call the RefreshSortPosition method of the record that the XamDataGrid creates for the newly inserted data item. I am not aware of any other method that does not require procedural code.

    Another way would be to wrap your data source into a collection view (ListCollectionView or BindingListCollectionView) and use its sorting. Calling the view's refresh method will make the XamDataGrid insert the record into its sorted position.