From 80c83a4d8a048341d8f3a0324bb827196e579f34 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 23 Mar 2016 21:55:07 +0100 Subject: [PATCH] Expose ScrollViewer CLR attached properties accessors. --- src/Perspex.Controls/ScrollViewer.cs | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Perspex.Controls/ScrollViewer.cs b/src/Perspex.Controls/ScrollViewer.cs index 1b6236a3b2..7aae3ade09 100644 --- a/src/Perspex.Controls/ScrollViewer.cs +++ b/src/Perspex.Controls/ScrollViewer.cs @@ -315,6 +315,46 @@ namespace Perspex.Controls get { return Max((_viewport.Height / _extent.Height) * (_extent.Height - _viewport.Height), 0); } } + /// + /// Gets the value of the HorizontalScrollBarVisibility attached property. + /// + /// The control to read the value from. + /// The value of the property. + public ScrollBarVisibility GetHorizontalScrollBarVisibility(Control control) + { + return control.GetValue(HorizontalScrollBarVisibilityProperty); + } + + /// + /// Gets the value of the HorizontalScrollBarVisibility attached property. + /// + /// The control to set the value on. + /// The value of the property. + public void SetHorizontalScrollBarVisibility(Control control, ScrollBarVisibility value) + { + control.SetValue(HorizontalScrollBarVisibilityProperty, value); + } + + /// + /// Gets the value of the VerticalScrollBarVisibility attached property. + /// + /// The control to read the value from. + /// The value of the property. + public ScrollBarVisibility GetVerticalScrollBarVisibility(Control control) + { + return control.GetValue(VerticalScrollBarVisibilityProperty); + } + + /// + /// Gets the value of the VerticalScrollBarVisibility attached property. + /// + /// The control to set the value on. + /// The value of the property. + public void SetVerticalScrollBarVisibility(Control control, ScrollBarVisibility value) + { + control.SetValue(VerticalScrollBarVisibilityProperty, value); + } + internal static Vector CoerceOffset(Size extent, Size viewport, Vector offset) { var maxX = Math.Max(extent.Width - viewport.Width, 0);