Bug 42509 - BoxView HeightRequest/AnchorY updates not correctly via binding!
Summary: BoxView HeightRequest/AnchorY updates not correctly via binding!
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2016-07-13 10:50 UTC by Rudolf Chrispens
Modified: 2017-06-19 18:41 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Drawing to reproduce issue/bug (304.69 KB, image/jpeg)
2016-07-13 10:50 UTC, Rudolf Chrispens

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rudolf Chrispens 2016-07-13 10:50:23 UTC
Created attachment 16642 [details]
Drawing to reproduce issue/bug

I have to show the Batterystatus of my Device and used an Boxview. (tested on Android)
Then I resized the Height of my Boxview via a binding of Heightrequest to my correct calculated value!

<BoxView Grid.Row="1" x:Name="mBatteryFill" BackgroundColor="#e7e7e7"              VerticalOptions="Start" HorizontalOptions="FillAndExpand" HeightRequest="{Binding MobileBatteryFillImageValue}"/>

The Bug:
The BoxView Resizes only when the user interacts with another native UI element, like a Slider or Button. But sinze I have responsive Design (Landscape and Portrait) I update my Values also in:

protected override void OnSizeAllocated(double width, double height)
            base.OnSizeAllocated(width, height); //must be called
            if (this._BindData.DeviceWidth != width || this._BindData.DeviceHeight != height)
                this._BindData.DeviceWidth = width;
                this._BindData.DeviceHeight = height;

                //TODO change the responsive
                if (width > height)

But then my BoxViews do nothing until I use my UI. My Bindings are correct and the Labels update correctly with the right values! My Custom sliders are on the correct positions to but the BoxViews simply won't change.

Seems like there is some kind of Bug in the BoxView Update when a property like Heightrequest is changed!
Comment 1 Rudolf Chrispens 2016-07-17 17:04:44 UTC
Is this confirmed yet? 

Are there workarounds?
Comment 2 Rui Marinho 2016-08-12 11:43:27 UTC
Hi, have you tried calling  InvalidateMeasure ? 

Also i m not able to reproduce the bug properly, can you please provide a simple sample starting from a  blank Xamarin.Forms Solution?


Warm Regards
Xamarin Forms Team
Comment 3 Samantha Houts [MSFT] 2017-06-19 18:41:59 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!