Friday, 15 August 2014

c# - How can I prevent content in a Xamarin Forms ScrollView becoming stuck when the orientation changes? -



c# - How can I prevent content in a Xamarin Forms ScrollView becoming stuck when the orientation changes? -

say have xamarin forms scrollview command content.

the content such that; fits exclusively in viewport when device in portrait orientation however, extends beyond viewport when device in landscape orientation.

the problem

when rotate device landscape , scroll content bottom, rotate portrait, content not reset , cannot scrolled - stuck half way page.

this seems bug in xamarin forms happens in ios , not android. said, while until resolved. i'm looking suggestions on how prevent/overcome situation in mean time? perchance custom renderer?

here solution reproduce issue: https://github.com/afalz/scrollviewissue

i see you're using shared project (the xamarin.forms). when programming in ios project, can set contentsize of scrollview accommodate changing of layout (landscape, portrait).

scrollview scrollview = new scrollview(); scrollview.contentsize = new rectanglef(x, y, screenheight, screenwidth);

you can utilize override viewdidrotate method , alter contentsize property.

for example, think you'd best off implement method gets called every time alter screen layout, viewdidrotate method, , alter scrollview.content.heightrequest new screensize.

i hope helps. luck!

c# ios xamarin xamarin.forms

No comments:

Post a Comment