Skip to content

Commit

Permalink
feat(scrollViewer): Add support of managed ScrollBar in ScrollViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Aug 3, 2020
1 parent 8d00359 commit efcc30f
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public bool IsVerticalScrollChainingEnabled
// Skipping already declared property VerticalSnapPointsAlignment
// Skipping already declared property VerticalScrollMode
// Skipping already declared property VerticalScrollBarVisibility
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.UI.Xaml.Visibility ComputedHorizontalScrollBarVisibility
{
Expand All @@ -165,7 +165,7 @@ public bool IsVerticalScrollChainingEnabled
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.UI.Xaml.Visibility ComputedVerticalScrollBarVisibility
{
Expand Down Expand Up @@ -314,15 +314,15 @@ public bool CanContentRenderOutsideBounds
new FrameworkPropertyMetadata(default(global::System.Collections.Generic.IList<float>)));
#endif
// Skipping already declared property BringIntoViewOnFocusChangeProperty
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty ComputedHorizontalScrollBarVisibilityProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
nameof(ComputedHorizontalScrollBarVisibility), typeof(global::Windows.UI.Xaml.Visibility),
typeof(global::Windows.UI.Xaml.Controls.ScrollViewer),
new FrameworkPropertyMetadata(default(global::Windows.UI.Xaml.Visibility)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty ComputedVerticalScrollBarVisibilityProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
Expand Down
22 changes: 11 additions & 11 deletions src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ partial void ChangeViewScroll(double? horizontalOffset, double? verticalOffset,

if (disableAnimation)
{
_sv.ScrollTo(physicalHorizontalOffset, physicalVerticalOffset);
_presenter.ScrollTo(physicalHorizontalOffset, physicalVerticalOffset);
}
else
{
_sv.SmoothScrollTo(physicalHorizontalOffset, physicalVerticalOffset);
_presenter.SmoothScrollTo(physicalHorizontalOffset, physicalVerticalOffset);
}
}

Expand All @@ -63,9 +63,9 @@ partial void ChangeViewZoom(float zoomFactor, bool disableAnimation)
{
this.Log().Warn("ChangeView: Animated zoom not yet implemented for Android.");
}
if (_sv != null)
if (_presenter != null)
{
_sv.ZoomScale = zoomFactor;
_presenter.ZoomScale = zoomFactor;
}
}

Expand Down Expand Up @@ -134,21 +134,21 @@ private void UpdateZoomedContentAlignment()

partial void OnZoomModeChangedPartial(ZoomMode zoomMode)
{
if (_sv != null)
if (_presenter != null)
{
_sv.IsZoomEnabled = zoomMode == ZoomMode.Enabled;
_presenter.IsZoomEnabled = zoomMode == ZoomMode.Enabled;

// Apply these in case _sv was not initialized when they were set
_sv.MinimumZoomScale = MinZoomFactor;
_sv.MaximumZoomScale = MaxZoomFactor;
// Apply these in case _presenter was not initialized when they were set
_presenter.MinimumZoomScale = MinZoomFactor;
_presenter.MaximumZoomScale = MaxZoomFactor;
}
}

partial void OnBringIntoViewOnFocusChangeChangedPartial(bool newValue)
{
if (_sv != null)
if (_presenter != null)
{
_sv.BringIntoViewOnFocusChange = newValue;
_presenter.BringIntoViewOnFocusChange = newValue;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Windows.UI.Xaml.Controls
{
public partial class ScrollViewer
{
internal Size ScrollBarSize => (_sv as ScrollContentPresenter)?.ScrollBarSize ?? default;
internal Size ScrollBarSize => (_presenter as ScrollContentPresenter)?.ScrollBarSize ?? default;

public Color BackgroundColor
{
Expand Down
Loading

0 comments on commit efcc30f

Please sign in to comment.