This question is locked. New answers and comments are not allowed.
Hello,
I have a GridView bound to an ObservableCollection<Item>. Each item holds a property called "Order" which holds the display order. When the collection is initialized, it is sorted based on the order and bound to the GridView. GridView shows items in sorted order.
I have a "Move Up" and "Move down" button that moves the selected items up or down. The way this is implemented is by incrementing or decrementing order on the selected item, sort the collection and trigger a property change notification for the grid to redraw. This works well until you have a scroll bar. When the grid redraw the items, the focus is moving to the beginning and scroll bar position is lost. For example, on a grid where 70 rows are there and moving 70th row one level up will jump the focus to the first item and scroll bar will also go back to the first position.
I am wondering is there any way to approach this problem?
I have a GridView bound to an ObservableCollection<Item>. Each item holds a property called "Order" which holds the display order. When the collection is initialized, it is sorted based on the order and bound to the GridView. GridView shows items in sorted order.
I have a "Move Up" and "Move down" button that moves the selected items up or down. The way this is implemented is by incrementing or decrementing order on the selected item, sort the collection and trigger a property change notification for the grid to redraw. This works well until you have a scroll bar. When the grid redraw the items, the focus is moving to the beginning and scroll bar position is lost. For example, on a grid where 70 rows are there and moving 70th row one level up will jump the focus to the first item and scroll bar will also go back to the first position.
I am wondering is there any way to approach this problem?