diff options
author | jh5.cho <jh5.cho@samsung.com> | 2016-12-26 17:06:19 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-02-03 13:26:49 +0900 |
commit | eaa8827020943141e10293ee2a369f140c6c19c6 (patch) | |
tree | 8375d2f5da407a4cf7b5442e86cc20712377a24d | |
parent | 9ca50746ff46ef8b617e730fb204db205bb848a7 (diff) | |
download | xamarin-forms-eaa8827020943141e10293ee2a369f140c6c19c6.tar.gz xamarin-forms-eaa8827020943141e10293ee2a369f140c6c19c6.tar.bz2 xamarin-forms-eaa8827020943141e10293ee2a369f140c6c19c6.zip |
Fix Scrolling to Specific Element in ScrollView
- Add the calculation code for getting coordination of given Element
: ScrollToAsync() which has Element parameter did not work.
It always scroll to (0,0) because there were no calculation code for Element.
TASK=TCAPI-2174
Change-Id: I6f3fbdbd060b1c74bc89c25e7e46d99cf10fbf51
-rwxr-xr-x | Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs index a566f24a..11195386 100755 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs @@ -123,7 +123,16 @@ namespace Xamarin.Forms.Platform.Tizen void ScrollRequestHandler(object sender, ScrollToRequestedEventArgs e) { - Rect region = new Rect(ToNativeDimension(e.ScrollX), ToNativeDimension(e.ScrollY), ToNativeDimension(Element.Width), ToNativeDimension(Element.Height)); + var x = e.ScrollX; + var y = e.ScrollY; + if (e.Mode == ScrollToMode.Element) + { + Point itemPosition = (Element as IScrollViewController).GetScrollPositionForElement(e.Element as VisualElement, e.Position); + x = itemPosition.X; + y = itemPosition.Y; + } + + Rect region = new Rect(ToNativeDimension(x), ToNativeDimension(y), ToNativeDimension(Element.Width), ToNativeDimension(Element.Height)); Control.ScrollTo(region, e.ShouldAnimate); } } |