Using Multiple Properties in Relative Layout Constraint Expressions on XAML

Abdul.3549Abdul.3549 USMember ✭✭

i want to use Height and Y property-

RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=BtnAllRegion, Property=Height+Y, Factor=1, Constant=10}"

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Property here is a string value, we can't set it with some "+" expression.
    I think we can achieve that using code behind, set the other constraints in XAML except the YConstraint. Then define that in code behind:

    RelativeLayout.SetYConstraint(customControl, Constraint.RelativeToView(BtnAllRegion, (parent, sibling) =>
    {
        return sibling.Y + sibling.Height;
    }));
    
Sign In or Register to comment.