From bab5e7402708ef3e52c2bf57a193318226ad7bbd Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 24 Feb 2023 23:58:12 +0100 Subject: [PATCH] Don't think exceptions in carousel panel. `VirtualizingCarouselPanel` can't bring items into view (it can't scroll) or get a control in a direction (it only hosts one control) but we shouldn't throw `NotImplementedException` as these methods can still be called. Just make them a no-op. Fixes #10374 --- src/Avalonia.Controls/VirtualizingCarouselPanel.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Controls/VirtualizingCarouselPanel.cs b/src/Avalonia.Controls/VirtualizingCarouselPanel.cs index f655fd18d4..da0ff1eb69 100644 --- a/src/Avalonia.Controls/VirtualizingCarouselPanel.cs +++ b/src/Avalonia.Controls/VirtualizingCarouselPanel.cs @@ -80,16 +80,8 @@ namespace Avalonia.Controls remove => _scrollInvalidated -= value; } - bool ILogicalScrollable.BringIntoView(Control target, Rect targetRect) - { - throw new NotImplementedException(); - } - - Control? ILogicalScrollable.GetControlInDirection(NavigationDirection direction, Control? from) - { - throw new NotImplementedException(); - } - + bool ILogicalScrollable.BringIntoView(Control target, Rect targetRect) => false; + Control? ILogicalScrollable.GetControlInDirection(NavigationDirection direction, Control? from) => null; void ILogicalScrollable.RaiseScrollInvalidated(EventArgs e) => _scrollInvalidated?.Invoke(this, e); protected override Size MeasureOverride(Size availableSize)