title: Custom layout, Xamarin forms. Best approach
body: <p>I'm new to Xamarin.Forms and Xaml and this. I have made a custom control i would like to utilize as a custom background throughout my app. The custom control is made as a contentview and looks like this.</p>
  
  <pre><code> &lt;ContentView.Content&gt;
      &lt;ScrollView&gt;
          &lt;StackLayout&gt;
              &lt;RelativeLayout Padding="0" BackgroundColor="Teal" VerticalOptions="Start"&gt;
                  &lt;Image Source="TopBG" BackgroundColor="Purple" Aspect="Fill" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6}" /&gt;
              &lt;/RelativeLayout&gt;
              &lt;Frame Padding="0" Margin="0,-25,0,0" CornerRadius="25" BackgroundColor="{StaticResource Key=Charcoal}"&gt;
                  &lt;StackLayout Margin="0,0,0,0" VerticalOptions="StartAndExpand" BackgroundColor="Transparent" x:Name="InnerStack"&gt;
  
  
                      &lt;!--I can insert custom controls here, but htat would determine this custom contentView for one purpose only--&gt;
  
                  &lt;/StackLayout&gt;
              &lt;/Frame&gt;
          &lt;/StackLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/ContentView.Content&gt;
  </code></pre>
  
  <p>The custom control is then implemented on my ContentPage as such:</p>
  
  <pre><code>&lt;ContentPage.Content&gt;
  
      &lt;CustomLayouts:ContentBackground&gt;
  
          &lt;!-- I would instead like to be able to add content here, and have it go into the stacklayout of the custom view.
          This way i could utilize the same background but have different content go into it depending on my wishes --&gt;
  
      &lt;/CustomLayouts:ContentBackground&gt;
  
  &lt;/ContentPage.Content&gt;
  </code></pre>
  
  <p>If i add a label inside that later example it just overrides everything and places a label, but not as intended inside the designated inner stackview of my ContentBackground.</p>
  
  <p>The only thing i can think of is figuring some way of accesing the InnerStackView of my custom contentBackground, then accesing the children property of that Stacklayout and then Children.add(View) to that stack layout. Allthough this means i will have to do it from code and i would like to achieve this behaviour in XAML since that is more familiar to me.</p>
  
  <p>Is this the only way or is there an alternative to achieve my goal in XAML? </p>