Skip to content

TreeDataGridPresenterBase Replace Regression #265

@xLEGiON

Description

@xLEGiON

Pull request #241 ported some fixes from AvaloniaUI/Avalonia#13795 to RealizedStackElements, including the new ItemsReplaced method. It also made use of this more efficient method in TreeDataGridPresenterBase when the items collection changed with a NotifyCollectionChangedAction.Replace action.

However, this made the assumption that the old and new items of the NotifyCollectionChangedEventArgs have the same length. When this is not true (e.g. replacing 2 items with 1 or 3 items), the TreeDataGrid does not display the collection change correctly. Before this change to TreeDataGridPresenterBase, the collection change was displayed correctly.

To fix this, it is still possible to use the more efficient ItemsReplaced method when the old and new items have the same length, but use the previous behavior when they do not. I've tested this idea and it fixes the issue. I will create a pull request with the proposed change.

Environment:
TreeDataGrid Version: 11.0.2
Avalonia Version: 11.0.6
Operating System: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions