summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjh5.cho <jh5.cho@samsung.com>2016-12-26 08:06:19 (GMT)
committerjh5.cho <jh5.cho@samsung.com>2016-12-26 08:08:14 (GMT)
commit35129de4b84e71802c3ba13bad965fe94d134fb9 (patch)
tree33ed96f31a6731698e00a195f17341facd24047e
parentaa0cf74ac39c66c43c7440c2cde88461ab7b196f (diff)
downloadxamarin-forms-35129de4b84e71802c3ba13bad965fe94d134fb9.zip
xamarin-forms-35129de4b84e71802c3ba13bad965fe94d134fb9.tar.gz
xamarin-forms-35129de4b84e71802c3ba13bad965fe94d134fb9.tar.bz2
Fix Scrolling to Specific Element in ScrollViewrefs/changes/46/107046/1
- 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-xXamarin.Forms.Platform.Tizen/Renderers/ScrollViewRenderer.cs11
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 a566f24..1119538 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);
}
}