Xamarin.Forms Guides | Samples

Xamarin.Forms.VisualElement.MinimumHeightRequest Property

Gets or sets a value which overrides the minimum height the element will request during layout.

Syntax

public Double MinimumHeightRequest { get; set; }

Value

The minimum height the element requires. Default value is -1.

Remarks

MinimumHeightRequest is used to override the results of a call to VisualElement.GetSizeRequest (double, double) by setting the minimum height property. This causes overflow handling to shrink this element to its minimum height before elements who do not have a minimum size set.

The following example sets the MinimumHeightRequest to enable an image to shrink below it's normal size.

C# Example

  void Build (string veryLongString)
  {
    var label = new Label {Text = veryLongString};
    var image = new Image {Source = "image500x500.png"};

    image.MinimumHeightRequest = 20;
    Content = new StackLayout {
      Children {
        label,
        image
      }
    };
  }

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0