Grid row height binding does not work

PhilipGruebelePhilipGruebele ✭✭USMember ✭✭
edited January 2015 in Xamarin.Forms

Basically in the XAML below, the binding is ignored and the property Get never called. There are also no binding related messages.

<Grid >
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="{Binding Path=ToolbarHeight,Mode=TwoWay}" />
    </Grid.RowDefinitions>
    .....
</Grid>

Other VM bindings work and also log debug errors when wrong, but it looks like something is not implemented for grid row height?

The VM bits are as follows and appear correct so the problem appears to be on the Xamarin side of things.

    private GridLength toolbarHeight;
    public GridLength ToolbarHeight
    {
        get
        {
            return toolbarHeight;  // Never gets called
        }
        set
        {
            SetProperty(ref toolbarHeight, value);
        }
    }

This is with the latest alpha bits as of today. I don't know if this was an issue with previous builds because I just started using Xamarin.Forms.

Cheers

Posts

  • johanksonjohankson ✭✭ SEInsider, University ✭✭

    I'm experiencing the same issue. Any more info on this?

  • MichaelRiley.0899MichaelRiley.0899 USMember, University

    I do not have an answer for you in Xamarin, but I do know that in WPF/Silverlight XAML, these values are not bindable. There are hacks used to work around it in WPF/Silverlight, but I doubt they would work here. I've gone to simply assigning star values:

    <Grid > <Grid.RowDefinitions> <RowDefinition Height="90*"/> <RowDefinition Height="10*" /> </Grid.RowDefinitions> ..... </Grid>

  • PhilipGruebelePhilipGruebele ✭✭ USMember ✭✭

    Mike, I think you are mistaken about WPF not supporting bindings here.

    The problem is that when targeting multiple platforms with XF one often has to tweak sizes based on resolution etc. So it would be very handy to use bindings here. I resigned myself to doing this in code-behind. Messier but it works.

  • BuhhSathBuhhSath ✭✭ USMember ✭✭
    edited December 2016

    /

  • RockMeAmadeusRockMeAmadeus ✭✭ USMember ✭✭

    +1

Sign In or Register to comment.