From 078185d7c057e460b5b4f06e78ebaeca30692192 Mon Sep 17 00:00:00 2001
From: Tom Edwards <109803929+TomEdwardsEnscape@users.noreply.github.com>
Date: Mon, 20 Nov 2023 07:17:53 +0100
Subject: [PATCH] Deferred scrolling (#13644)
* Implemented deferred scrolling
* Set IsDeferredScrollingEnabled in themes, where relevant
---
.../Pages/ScrollViewerPage.xaml | 3 +
.../Themes/Fluent/ColorView.xaml | 1 +
.../Themes/Simple/ColorView.xaml | 1 +
src/Avalonia.Controls/Primitives/ScrollBar.cs | 1 +
src/Avalonia.Controls/Primitives/Track.cs | 67 ++++++++++++++++---
src/Avalonia.Controls/ScrollViewer.cs | 26 +++++++
.../Controls/ComboBox.xaml | 3 +-
.../Controls/ListBox.xaml | 1 +
.../Controls/ScrollBar.xaml | 2 +
.../Controls/TreeView.xaml | 1 +
.../Controls/ComboBox.xaml | 3 +-
.../Controls/ListBox.xaml | 1 +
.../Controls/ScrollBar.xaml | 2 +
.../Controls/TreeView.xaml | 1 +
.../ScrollViewerTests.cs | 41 ++++++++++++
15 files changed, 143 insertions(+), 11 deletions(-)
diff --git a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
index 4af61c3399..f931542a04 100644
--- a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
+++ b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
@@ -17,6 +17,9 @@
Content="Allow auto hide" />
+
diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml
index 9ca55566f3..e4a8ecace4 100644
--- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml
+++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml
@@ -96,6 +96,7 @@
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
+ IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
Bind(p, owner.GetObservable(ScrollViewer.ScrollBarMaximumProperty, ExtractOrdinate), BindingPriority.Template)),
IfUnset(ValueProperty, p => Bind(p, owner.GetObservable(ScrollViewer.OffsetProperty, ExtractOrdinate), BindingPriority.Template)),
+ IfUnset(ScrollViewer.IsDeferredScrollingEnabledProperty, p => Bind(p, owner.GetObservable(ScrollViewer.IsDeferredScrollingEnabledProperty), BindingPriority.Template)),
IfUnset(ViewportSizeProperty, p => Bind(p, owner.GetObservable(ScrollViewer.ViewportProperty, ExtractOrdinate), BindingPriority.Template)),
IfUnset(VisibilityProperty, p => Bind(p, owner.GetObservable(visibilitySource), BindingPriority.Template)),
IfUnset(AllowAutoHideProperty, p => Bind(p, owner.GetObservable(ScrollViewer.AllowAutoHideProperty), BindingPriority.Template)),
diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs
index 2152f4a2dd..1509b027c6 100644
--- a/src/Avalonia.Controls/Primitives/Track.cs
+++ b/src/Avalonia.Controls/Primitives/Track.cs
@@ -45,6 +45,10 @@ namespace Avalonia.Controls.Primitives
public static readonly StyledProperty IgnoreThumbDragProperty =
AvaloniaProperty.Register