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?
HI,
I will bring both issues to the attention of the developers
1) sort being lost when adding new rows to an empty grid
2) duplicate row added.
I will create a private case and email you shortly.
Sincerely,
Matt
Developer Support Engineer
I am using build # 12.2.20122.2204
I have replicated your first sort issue.
What version and Build are you using?
matt Developer Support Engineer
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; }