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
1675
Xamgrid broken sorting issue with collectionviewsource
posted

Hi,

Please see the attached example, if you click on the "Apply Layout" first and then click on "Add items" button then you'd see the column sorting breaks, but if you comment Sort function in CollectionOnCollectionChanged function on line 25 then sorting does not break, the first column is sorted correctly, can you please explain this behavior?

Sorting Issue.zip
Parents
  • 1675
    posted

    Also in the same example if i reset issorted to None first and then set the sort order then i see there are four items added insted of three. update the two functions in the previous example then click the update layout button and then additems button, you'll see 4 rows in the grid instead of 3

    private void AddItems(object sender, RoutedEventArgs e)
    {
    collection.Add(new Data() { Data1 = "Item 1"});
    collection.Add(new Data() { Data1 = "Item 2" });
    collection.Add(new Data() { Data1 = "Item 3" });
    }

    public void Sort()

    {
    var t = grid.Columns[0] as TextColumn;
    t.IsSorted = SortDirection.None;
    t.IsSorted = SortDirection.Ascending;
    }

Reply Children