From e63fc96c848d9f89ec9dc49f15514defdc6a76ff Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 5 May 2019 21:12:01 +0200 Subject: [PATCH] Fix failing test. And remove empty method. --- src/Avalonia.Controls/Presenters/CarouselPresenter.cs | 5 ----- .../Primitives/SelectingItemsControl.cs | 11 ++++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs index bdc4d29400..f887b987e0 100644 --- a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs +++ b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs @@ -94,11 +94,6 @@ namespace Avalonia.Controls.Presenters set { SetValue(PageTransitionProperty, value); } } - protected override void PanelCreated(IPanel panel) - { - base.PanelCreated(panel); - } - /// protected override void ItemsChanged(NotifyCollectionChangedEventArgs e) { diff --git a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs index a64dbe0546..280c3ad93a 100644 --- a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs @@ -325,14 +325,19 @@ namespace Avalonia.Controls.Primitives if (_updateCount == 0) { + var newIndex = -1; + if (SelectedIndex != -1) { - SelectedIndex = IndexOf((IEnumerable)e.NewValue, SelectedItem); + newIndex = IndexOf((IEnumerable)e.NewValue, SelectedItem); } - else if (AlwaysSelected && Items != null && Items.Cast().Any()) + + if (AlwaysSelected && Items != null && Items.Cast().Any()) { - SelectedIndex = 0; + newIndex = 0; } + + SelectedIndex = newIndex; } }