Skip to content

Commit

Permalink
Don't think exceptions in carousel panel.
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
grokys committed Feb 24, 2023
1 parent bc74d04 commit bab5e74
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Avalonia.Controls/VirtualizingCarouselPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,8 @@ event EventHandler? ILogicalScrollable.ScrollInvalidated
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)
Expand Down

0 comments on commit bab5e74

Please sign in to comment.