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
280
xamDataGrid does not automatically apply sorting when ObservableCollection Changed
posted

Hi, here is my code:

 

void grdTradeHistory_Loaded(object sender, RoutedEventArgs e)
        {
           
            FieldLayout layout = this.grdTradeHistory.DefaultFieldLayout;
            RecordFilterCollection filters = layout.RecordFilters;
            RecordFilter filter = new RecordFilter(layout.Fields["Status"]);
            filter.Conditions.Add(new ComparisonCondition(ComparisonOperator.StartsWith, this.grdTradeHistory.Tag.ToString()));
            filters.Add(filter);

            layout.SortedFields.Add(new FieldSortDescription("OrderDate", System.ComponentModel.ListSortDirection.Descending, false));
        }

 

When I change ObservableCollection<T> the grid not autosort the new result. It move bottom of the grid. As you see I sort by OrderDate and suppose new orders to be on top of the grid but it seems this not work.

Please advise.

 

Regards,

Saykor