如何获取wp7中scrollview的最大偏移量?
我设法获取并将scrollerOffest设置为:
double horizonatalOffest = sv.HorizontalOffset;
Debug.WriteLine("horizonlat offset: " + horizonatalOffest.ToString());
sv.ScrollToHorizontalOffset(2000);
问题是如何获取最大偏移量。假设我的滚动条为 0 到 50000。那么如何获得最大偏移量呢? Scrollview.HorizontalOffset
返回当前偏移位置?请注意,我的滚动条在运行时会增大/缩小。
I manged to get and set scrollerOffest as :
double horizonatalOffest = sv.HorizontalOffset;
Debug.WriteLine("horizonlat offset: " + horizonatalOffest.ToString());
sv.ScrollToHorizontalOffset(2000);
The problem is how to get the max offset. Say I have the scroller 0 to 50000. So how can I get max offset? Scrollview.HorizontalOffset
returns current offset position? Note that My scroller grows/shrinks during run time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ScrollViewer
的最大偏移量取决于其内容。获取ScrollViewer
的子级,并通过其ActualHeight
属性获取其高度。然后减去ScrollViewer
ActualHeight
属性值即可得到最大偏移量。The maximum offset for the
ScrollViewer
will depend on its content. Obtain the child of theScrollViewer
, and obtain its height via itsActualHeight
property. You then subtract theScrollViewer
ActualHeight
property value to give you the maximum offset.