locked
Grid row height binding does not work RRS feed

  • Question

  • User96360 posted

    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

    Tuesday, January 6, 2015 11:04 PM

All replies

  • User987 posted

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

    Wednesday, February 4, 2015 8:16 AM
  • User95146 posted

    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>

    Saturday, March 14, 2015 5:27 PM
  • User96360 posted

    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.

    Saturday, March 14, 2015 5:33 PM
  • User120789 posted

    /

    Monday, December 5, 2016 7:35 PM
  • User20092 posted

    +1

    Tuesday, August 8, 2017 9:24 PM