diff --git a/samples/XamlTestApplicationPcl/TestScrollable.cs b/samples/XamlTestApplicationPcl/TestScrollable.cs
index 2b16899ee1..39e708d043 100644
--- a/samples/XamlTestApplicationPcl/TestScrollable.cs
+++ b/samples/XamlTestApplicationPcl/TestScrollable.cs
@@ -18,12 +18,12 @@ namespace XamlTestApplication
public bool IsLogicalScrollEnabled => true;
public Action InvalidateScroll { get; set; }
- Size ILogicalScrollable.Extent
+ Size IScrollable.Extent
{
get { return _extent; }
}
- Vector ILogicalScrollable.Offset
+ Vector IScrollable.Offset
{
get { return _offset; }
@@ -34,7 +34,7 @@ namespace XamlTestApplication
}
}
- Size ILogicalScrollable.Viewport
+ Size IScrollable.Viewport
{
get { return _viewport; }
}
diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj
index 11f8979a43..80d29b14ab 100644
--- a/src/Avalonia.Controls/Avalonia.Controls.csproj
+++ b/src/Avalonia.Controls/Avalonia.Controls.csproj
@@ -54,6 +54,7 @@
+
diff --git a/src/Avalonia.Controls/IScrollable.cs b/src/Avalonia.Controls/IScrollable.cs
new file mode 100644
index 0000000000..9bbd0d8518
--- /dev/null
+++ b/src/Avalonia.Controls/IScrollable.cs
@@ -0,0 +1,29 @@
+// Copyright (c) The Avalonia Project. All rights reserved.
+// Licensed under the MIT license. See licence.md file in the project root for full license information.
+
+using System;
+using Avalonia.VisualTree;
+
+namespace Avalonia.Controls.Primitives
+{
+ ///
+ /// Interface implemented by scrollable controls.
+ ///
+ public interface IScrollable
+ {
+ ///
+ /// Gets the extent of the scrollable content, in logical units
+ ///
+ Size Extent { get; }
+
+ ///
+ /// Gets or sets the current scroll offset, in logical units.
+ ///
+ Vector Offset { get; set; }
+
+ ///
+ /// Gets the size of the viewport, in logical units.
+ ///
+ Size Viewport { get; }
+ }
+}
diff --git a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
index 8c05067fc7..817d734506 100644
--- a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
@@ -51,20 +51,20 @@ namespace Avalonia.Controls.Presenters
}
///
- Action ILogicalScrollable.InvalidateScroll { get; set; }
-
- ///
- Size ILogicalScrollable.Extent => _virtualizer.Extent;
+ Size IScrollable.Extent => _virtualizer.Extent;
///
- Vector ILogicalScrollable.Offset
+ Vector IScrollable.Offset
{
get { return _virtualizer.Offset; }
set { _virtualizer.Offset = CoerceOffset(value); }
}
///
- Size ILogicalScrollable.Viewport => _virtualizer.Viewport;
+ Size IScrollable.Viewport => _virtualizer.Viewport;
+
+ ///
+ Action ILogicalScrollable.InvalidateScroll { get; set; }
///
Size ILogicalScrollable.ScrollSize => new Size(0, 1);
diff --git a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
index 4594e31ac8..9e64694f8e 100644
--- a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
@@ -15,7 +15,7 @@ namespace Avalonia.Controls.Presenters
///
/// Presents a scrolling view of content inside a .
///
- public class ScrollContentPresenter : ContentPresenter, IPresenter
+ public class ScrollContentPresenter : ContentPresenter, IPresenter, IScrollable
{
///
/// Defines the property.
diff --git a/src/Avalonia.Controls/Primitives/ILogicalScrollable.cs b/src/Avalonia.Controls/Primitives/ILogicalScrollable.cs
index 8c55e1d4a2..b8b90f83a9 100644
--- a/src/Avalonia.Controls/Primitives/ILogicalScrollable.cs
+++ b/src/Avalonia.Controls/Primitives/ILogicalScrollable.cs
@@ -17,7 +17,7 @@ namespace Avalonia.Controls.Primitives
/// whereas logical scrolling means that the scrolling is handled by the child control itself
/// and it can choose to do handle the scroll information as it sees fit.
///
- public interface ILogicalScrollable
+ public interface ILogicalScrollable : IScrollable
{
///
/// Gets a value indicating whether logical scrolling is enabled on the control.
@@ -30,7 +30,8 @@ namespace Avalonia.Controls.Primitives
///
///
/// This method notifies the attached of a change in
- /// the , or properties.
+ /// the , or
+ /// properties.
///
///
/// This property is set by the parent when the
@@ -39,21 +40,6 @@ namespace Avalonia.Controls.Primitives
///
Action InvalidateScroll { get; set; }
- ///
- /// Gets the extent of the scrollable content, in logical units
- ///
- Size Extent { get; }
-
- ///
- /// Gets or sets the current scroll offset, in logical units.
- ///
- Vector Offset { get; set; }
-
- ///
- /// Gets the size of the viewport, in logical units.
- ///
- Size Viewport { get; }
-
///
/// Gets the size to scroll by, in logical units.
///
diff --git a/src/Avalonia.Controls/ScrollViewer.cs b/src/Avalonia.Controls/ScrollViewer.cs
index 4f5cf304b2..e9d1e56b3a 100644
--- a/src/Avalonia.Controls/ScrollViewer.cs
+++ b/src/Avalonia.Controls/ScrollViewer.cs
@@ -12,7 +12,7 @@ namespace Avalonia.Controls
///
/// A control scrolls its content if the content is bigger than the space available.
///
- public class ScrollViewer : ContentControl
+ public class ScrollViewer : ContentControl, IScrollable
{
///
/// Defines the property.