<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XamarinStudy.Views.SampleRelativeLayoutPage">
    <ContentPage.Content>
        <RelativeLayout>
            <!--BoxView Default Size = 40,40-->
            <BoxView BackgroundColor="Red" 
                     RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"/>
            <BoxView BackgroundColor="Green" 
                     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-40}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"/>
            <BoxView BackgroundColor="Blue" 
                     RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Constant=-40}"/>
            <BoxView BackgroundColor="Yellow" 
                     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-40}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Constant=-40}"/>
            <BoxView x:Name="centerBox" Color="Silver" 
                     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.33}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.33}"
                     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.33}"
                     RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.33}"/>
            <BoxView BackgroundColor="Violet"
                     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=centerBox, Property=Width}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=centerBox, Property=Height}"
                     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=centerBox, Property=Width, Factor=0.33}"
                     RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=centerBox, Property=Height, Factor=0.33}"/>
        </RelativeLayout>
    </ContentPage.Content>
</ContentPage>