Forum Xamarin.Forms

Update Heightrequest Rendering

R_CR_C USMember
edited July 2016 in Xamarin.Forms

Hey Guys,
I make some calculations for a BoxView and change the .Heightrequest acordingly.
Everything works fine but the UI updates only when I use a slider or a button.

What do I have to call to update the Layout/UI rendering?

Thanks in advance!


  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭
    edited July 2016

    Does it work if you use the .Layout() method on the boxview instead?

  • R_CR_C USMember
    edited July 2016

    @JacobPoulsen_ said:
    Does it work if you use the .Layout() method on the boxview instead?

    Thanks for the reply!
    I Changed the function out the uptade is the same. But I got a flickering with the .Layout() function so I changed it back to heightrequest.

    I guess I have a problem with my update code. The BoxView represents the Battery of the Device.
    I have to find a way to update my BoxView after Landscape and Portrait rotation. And also on application start.

    I thought that If I bind my Heightrequest to a BindableProperty (in XAML) that when I change the BP the UI would update automaticaly without me subscribing to the PropertyChanged Event.

    Is this intended or did I misunderstood something?

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

  • R_CR_C USMember
    edited July 2016

    So all my Values are correct and set when something changes. I see them update on my Labels but the BoxViews are still not corectly placed until I use one of the native UIs)

    -> How come the Labels update their "Text" but heightrequest does nothing?

    mBatteryFill.Measure(mBatteryFill.WidthRequest, mBatteryFill.HeightRequest); //does nothing?
  • R_CR_C USMember
    edited July 2016

    Ok since there seems to be no solution:

    Hope this will be fixed fast because I need this functionality. Or at least a workaround for this!

  • R_CR_C USMember

    Found a workaround with a realy dirty hack!
    :/ just define a simple bool in your bindings and change it every so so frames...

Sign In or Register to comment.