Avalonia: Selection and ObservableCollection issue

Created on 11 Sep 2020  路  2Comments  路  Source: AvaloniaUI/Avalonia

Reproduction steps (i used ControlCatalog):

  1. Add a "Delete" button to the TabControl page:
<Button Command="{Binding DeleteTab}" Content="Delete"/>
  1. Change List to ObservableCollection:
    ```c#
    private class PageViewModel : ReactiveObject
    {
    private ObservableCollection _tabs;

    private Dock _tabPlacement;

    public ObservableCollection Tabs
    {
    get => _tabs;
    set => this.RaiseAndSetIfChanged(ref _tabs, value);
    }

    public Dock TabPlacement
    {
    get { return _tabPlacement; }
    set { this.RaiseAndSetIfChanged(ref _tabPlacement, value); }
    }

    private void DeleteTab()
    {
    Tabs.RemoveAt(0);
    }
    }
    ```

  2. Launch the application, click on the button and this will happen:
    8EUjwBGlpR

I'm guessing this was broken after the global changes related to the SelectionModel, since TabControl hasn't changed

Used the most recent preview of Avalonia

bug

Most helpful comment

Thanks for the excellent repro! On it now.

All 2 comments

Thanks for the excellent repro! On it now.

Perhaps this information can be useful.

If you delete any item before the selection, shows the previous item, not the selected one before deletion.
The deleted item is displayed here:
MvJDM6TwAA

And here is the previous one:
J05gULjRiD

When removing the last item, it highlights the first one (I don't think this will be critical).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxkatz6 picture maxkatz6  路  3Comments

grokys picture grokys  路  4Comments

akunchev picture akunchev  路  3Comments

SeleDreams picture SeleDreams  路  4Comments

MarchingCube picture MarchingCube  路  4Comments