New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Approach to get auto-sized StackLayout measured height in DP #4329
Comments
To get the size of your auto-sized StackLayout you need to use getMeasuredHeight and getMeasuredWidth. These methods will return the value in screen pixels which means that you will have to divide the value by the current screen scale to receive the value in DP (a.k.a DIPs). Once you get your size you can scroll to the wanted position with the scrollToVerticalOffset method on your ScrollView (or scrollToHorizontalOffset offset if you need to scroll horizontally). You still need to wrap the measurement in small timeout to make sure that the StackLayout has all its children loaded and measured.
page.xml
Demonstration project can be found here |
@NickIliev Is there any workaround for this |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm trying to figure out the height of a StackLayout element on the screen that has some content and is auto-sized. I need the sizing information to scroll and position elements on the screen. Whenever I call the effective* methods, I always get 0 in return. What's the proper approach to do these things?
The text was updated successfully, but these errors were encountered: