diff --git a/src/Avalonia.Controls.DataGrid/DataGrid.cs b/src/Avalonia.Controls.DataGrid/DataGrid.cs
index d61685932d..5d71a499e3 100644
--- a/src/Avalonia.Controls.DataGrid/DataGrid.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGrid.cs
@@ -2221,7 +2221,7 @@ namespace Avalonia.Controls
}
else
{
- e.Handled = e.Handled || !ScrollViewer.GetBubbleUpScrollOnEndReached(this);
+ e.Handled = e.Handled || !ScrollViewer.GetIsScrollChainingEnabled(this);
}
}
diff --git a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
index 9fc5f08986..6ba6d1e6d6 100644
--- a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
@@ -61,11 +61,12 @@ namespace Avalonia.Controls.Presenters
(o, v) => o.Viewport = v);
///
- /// Defines the property.
+ /// Defines the property.
///
- public static readonly StyledProperty BubbleUpScrollOnEndReachedProperty =
+ public static readonly StyledProperty IsScrollChainingEnabledProperty =
AvaloniaProperty.Register(
- nameof(BubbleUpScrollOnEndReached));
+ nameof(IsScrollChainingEnabled),
+ defaultValue: true);
private bool _canHorizontallyScroll;
private bool _canVerticallyScroll;
@@ -146,12 +147,17 @@ namespace Avalonia.Controls.Presenters
}
///
- /// Gets a value that indicates whether the scroll event should be bubbled up to the parent scroll viewer when the end is reached.
+ /// Gets or sets if scroll chaining is enabled. The default value is true.
///
- public bool BubbleUpScrollOnEndReached
+ ///
+ /// After a user hits a scroll limit on an element that has been nested within another scrollable element,
+ /// you can specify whether that parent element should continue the scrolling operation begun in its child element.
+ /// This is called scroll chaining.
+ ///
+ public bool IsScrollChainingEnabled
{
- get => GetValue(BubbleUpScrollOnEndReachedProperty);
- set => SetValue(BubbleUpScrollOnEndReachedProperty, value);
+ get => GetValue(IsScrollChainingEnabledProperty);
+ set => SetValue(IsScrollChainingEnabledProperty, value);
}
///
@@ -425,7 +431,7 @@ namespace Avalonia.Controls.Presenters
bool offsetChanged = newOffset != Offset;
Offset = newOffset;
- e.Handled = !BubbleUpScrollOnEndReached || offsetChanged;
+ e.Handled = !IsScrollChainingEnabled || offsetChanged;
}
}
@@ -463,7 +469,7 @@ namespace Avalonia.Controls.Presenters
bool offsetChanged = newOffset != Offset;
Offset = newOffset;
- e.Handled = !BubbleUpScrollOnEndReached || offsetChanged;
+ e.Handled = !IsScrollChainingEnabled || offsetChanged;
}
}
diff --git a/src/Avalonia.Controls/ScrollViewer.cs b/src/Avalonia.Controls/ScrollViewer.cs
index afa4301ae4..10a014e81d 100644
--- a/src/Avalonia.Controls/ScrollViewer.cs
+++ b/src/Avalonia.Controls/ScrollViewer.cs
@@ -182,12 +182,12 @@ namespace Avalonia.Controls
true);
///
- /// Defines the property.
+ /// Defines the property.
///
- public static readonly AttachedProperty BubbleUpScrollOnEndReachedProperty =
+ public static readonly AttachedProperty IsScrollChainingEnabledProperty =
AvaloniaProperty.RegisterAttached(
- nameof(BubbleUpScrollOnEndReached),
- false);
+ nameof(IsScrollChainingEnabled),
+ defaultValue: true);
///
/// Defines the event.
@@ -427,12 +427,17 @@ namespace Avalonia.Controls
}
///
- /// Gets a value that indicates whether the scroll event should be bubbled up to the parent scroll viewer when the end is reached.
+ /// Gets or sets if scroll chaining is enabled. The default value is true.
///
- public bool BubbleUpScrollOnEndReached
+ ///
+ /// After a user hits a scroll limit on an element that has been nested within another scrollable element,
+ /// you can specify whether that parent element should continue the scrolling operation begun in its child element.
+ /// This is called scroll chaining.
+ ///
+ public bool IsScrollChainingEnabled
{
- get => GetValue(BubbleUpScrollOnEndReachedProperty);
- set => SetValue(BubbleUpScrollOnEndReachedProperty, value);
+ get => GetValue(IsScrollChainingEnabledProperty);
+ set => SetValue(IsScrollChainingEnabledProperty, value);
}
///
@@ -566,23 +571,33 @@ namespace Avalonia.Controls
}
///
- /// Gets the value of the BubbleUpScrollOnEndReachedProperty attached property.
+ /// Sets the value of the IsScrollChainingEnabled attached property.
///
/// The control to set the value on.
/// The value of the property.
- public static void SetBubbleUpScrollOnEndReached(Control control, bool value)
+ ///
+ /// After a user hits a scroll limit on an element that has been nested within another scrollable element,
+ /// you can specify whether that parent element should continue the scrolling operation begun in its child element.
+ /// This is called scroll chaining.
+ ///
+ public static void SetIsScrollChainingEnabled(Control control, bool value)
{
- control.SetValue(BubbleUpScrollOnEndReachedProperty, value);
+ control.SetValue(IsScrollChainingEnabledProperty, value);
}
///
- /// Gets the value of the BubbleUpScrollOnEndReachedProperty attached property.
+ /// Gets the value of the IsScrollChainingEnabled attached property.
///
/// The control to read the value from.
/// The value of the property.
- public static bool GetBubbleUpScrollOnEndReached(Control control)
+ ///
+ /// After a user hits a scroll limit on an element that has been nested within another scrollable element,
+ /// you can specify whether that parent element should continue the scrolling operation begun in its child element.
+ /// This is called scroll chaining.
+ ///
+ public static bool GetIsScrollChainingEnabled(Control control)
{
- return control.GetValue(BubbleUpScrollOnEndReachedProperty);
+ return control.GetValue(IsScrollChainingEnabledProperty);
}
///
diff --git a/src/Avalonia.Themes.Default/Controls/ListBox.xaml b/src/Avalonia.Themes.Default/Controls/ListBox.xaml
index 1d653a34b5..b1fcb830b3 100644
--- a/src/Avalonia.Themes.Default/Controls/ListBox.xaml
+++ b/src/Avalonia.Themes.Default/Controls/ListBox.xaml
@@ -6,7 +6,7 @@
-
+
+ IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}">
-
+
-
+
-
+
@@ -29,7 +29,7 @@
+ IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}">
-
+
@@ -69,7 +69,7 @@
DockPanel.Dock="Top" />
-
+