Forum Xamarin.Forms


mshibanamimshibanami USMember
edited February 2017 in Xamarin.Forms


Add a static property Zero to GridLength class.

API Changes

It will work like this:

GridLength.Zero.Equals(new GridLength(0)); // true

I think this property can be implemented very easily. Just add this on here:

public static GridLength Zero
    get { return new GridLength(0, GridUnitType.Absolute); }

Intended Use Case

new GridLength(0) can be useful if we want to hide some Grid's rows or columns.

So I think it would be nice if we could use it on the plain XF.


Open · Last Updated


  • AdrianKnightAdrianKnight USMember ✭✭✭✭

    Wondering if this should be named AbsoluteZero since the underlying representation is in absolute terms.

    Compare this to:

    new GridLength(0, GridUnitType.Auto)
    new GridLength(0, GridUnitType.Star)
  • CharlesRoddieCharlesRoddie USMember ✭✭

    A good implementation would be
    GridLength as a 2D vector space of floats, with the first component being absolute, the second relative.
    Final layout length = absolute + k * relative, where k * sum of relatives = total - sum of absolutes.
    Then have sums and GridLength.Zero

Sign In or Register to comment.