2016-07-08 14 views
0

Ich habe folgend XAMLXAML Xamarin Forms Relative Layout-Bildposition Ausgabe

<RelativeLayout> 
<Image Source="background.jpg" 
     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X}" 
     RelativeLayout.WidthConstraint= 
       "{ConstraintExpression Type=RelativeToParent, Property=Width}" 
     RelativeLayout.HeightConstraint= 
       "{ConstraintExpression Type=RelativeToParent, Property=Height}"/> 


    <StackLayout 
     VerticalOptions="FillAndExpand" 
     Padding="10,10,10,0" 
     Orientation="Vertical" 
     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" 
    RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height}"> 

    <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Margin="0,30,0,10"> 
     <Image Source="icon.png" Margin="0,0,10,0" /> 
     <Label Text="Main menu" HorizontalOptions="FillAndExpand" Style="{DynamicResource TitleStyle}" /> 
    </StackLayout> 
    </StackLayout> 
</RelativeLayout> 

Dieses Bild in der Mitte des Inhalts macht, wie würde ich es an der Spitze des Inhalts mithilfe von XAML zu machen bekommen?

Antwort

0

Versuchen Sie, eine YConstraint in Bezug auf Eigenschaft Y

<RelativeLayout> 
    <Image Source="background.jpg" 
    RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=1, Constant=0}"