Forum Xamarin.Forms

how can stretch background content image?

How can i set the background no-repeat but stretch dinamically to all page?

Best Answer


  • SirAndriySirAndriy USMember ✭✭✭
    edited April 2016

    Create page with RelativeLayout and add there are Image with Aspect="AspectFill" and RelativeLayout.WidthConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Width}" and RelativeLayout.HeightConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Height}

    Something like this:

        <!-- Background -->
            RelativeLayout.WidthConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Width}"
            RelativeLayout.HeightConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Height}">
            Source = "background.png"
        <!-- Content-->

  • MestParisiMestParisi ITMember
    edited April 2016

    I have use Aspect="Fill" but the solutions is corrected! Thank's

  • Thank you SirAndriy ... you certainly saved my sorry backside with this solution ... cheers

Sign In or Register to comment.