title: How to add background image to Entry in Xamarin.Forms?
body: <p>my designer created a background image to style the inputs it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/OZfFP.png" alt="enter image description here"></p>
  
  <p>How could I accomplish that in Xamarin.Forms?
  The easy part I'm guessing is removing the border, but I also need to position it on top of that image (I'd assume using RelativeLayout?) and the hardest (in my point of view) setting its proper size to "fill" the remaining of the image.
  I'm using XAML, but if you know in C# I can extrapolate that, no problem.
  Any ideas?</p>
  
  <p>EDIT:
  This is what I've managed to do so far:
  <img src="https://i.stack.imgur.com/vxlOE.png" alt="enter image description here"></p>
  
  <p>The code:</p>
  
  <pre><code>&lt;RelativeLayout&gt;
    &lt;Image Source="input_selected.png"&gt;&lt;/Image&gt;
    &lt;StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand"&gt;
      &lt;Image Source="ico_password.png" Scale="0.7"&gt;&lt;/Image&gt;
      &lt;Entry x:Name="PasswordT" Placeholder="Senha" IsPassword="True" HorizontalOptions="CenterAndExpand" Text=""&gt;&lt;/Entry&gt;
    &lt;/StackLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>EDIT2:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               x:Class="LoginPage"
               Style="{StaticResource LoginBackground}"&gt;
    &lt;ScrollView&gt;
      &lt;RelativeLayout x:Name="RelativeLayoutLogin"&gt;
        &lt;StackLayout x:Name="BackgroundLayout" Spacing="15" HorizontalOptions="Center" VerticalOptions="Start"&gt;
          &lt;StackLayout.Padding&gt;
            &lt;OnPlatform x:TypeArguments="Thickness" iOS="15, 38, 15, 15" Android="15, 18, 15, 15" WinPhone="15, 18, 15, 15" /&gt;
          &lt;/StackLayout.Padding&gt;
          &lt;StackLayout.Children&gt;
            &lt;Image Source="logo.png" Aspect="AspectFit" HeightRequest="75"&gt;&lt;/Image&gt;
            &lt;Image x:Name="BackgroundBox" Source="box_completo.png" Aspect="AspectFill"&gt;&lt;/Image&gt;
          &lt;/StackLayout.Children&gt;
        &lt;/StackLayout&gt;
  
        &lt;StackLayout RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=BackgroundLayout, Property=Y, Constant=111}"
                     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=BackgroundLayout, Property=Width, Factor=1}"&gt;
          &lt;!--&lt;StackLayout.Padding&gt;
            &lt;OnPlatform x:TypeArguments="Thickness" iOS="15, 38, 15, 15" Android="15, 18, 15, 15" WinPhone="15, 18, 15, 15" /&gt;
          &lt;/StackLayout.Padding&gt;--&gt;
          &lt;RelativeLayout&gt;
            &lt;Image Source="input.png" x:Name="BgUsername"&gt;&lt;/Image&gt;
            &lt;Image Source="input_selected.png" x:Name="SelectedBgUsername" IsVisible="False"&gt;&lt;/Image&gt;
            &lt;StackLayout RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=8}"
                      RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=8}"
                      RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-16}"
                      RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Constant=-16}"
                      Orientation="Horizontal"&gt;
              &lt;Image Source="ico_user.png" Scale="0.6"&gt;&lt;/Image&gt;
              &lt;Entry x:Name="UsernameOrEmail" Placeholder="Nome de usuário" IsEnabled="True" HorizontalOptions="FillAndExpand" Text="" TextColor="Black"&gt;&lt;/Entry&gt;
            &lt;/StackLayout&gt;
          &lt;/RelativeLayout&gt;
          &lt;RelativeLayout&gt;
            &lt;Image Source="input.png" x:Name="BgPassword"&gt;&lt;/Image&gt;
            &lt;Image Source="input_selected.png" x:Name="SelectedBgPassword" IsVisible="False"&gt;&lt;/Image&gt;
            &lt;StackLayout RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=8}"
                        RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=8}"
                        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-16}"
                        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Constant=-16}"
                        Orientation="Horizontal"&gt;
              &lt;Image Source="ico_password.png" Scale="0.6"&gt;&lt;/Image&gt;
              &lt;Entry x:Name="Password" Placeholder="Senha" IsPassword="True" HorizontalOptions="FillAndExpand" Text="" TextColor="Black"&gt;&lt;/Entry&gt;
            &lt;/StackLayout&gt;
          &lt;/RelativeLayout&gt;
          &lt;!--&lt;RelativeLayout Scale="0.85"&gt;
            &lt;Image Source="input.png" x:Name="BgUsername"&gt;&lt;/Image&gt;
            &lt;Image Source="input_selected.png" x:Name="SelectedBgUsername" IsVisible="False"&gt;&lt;/Image&gt;
            &lt;StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Padding="15, 5, 0, 0"&gt;
              &lt;Image Source="ico_user.png" Scale="0.6"&gt;&lt;/Image&gt;
              &lt;Entry x:Name="UsernameOrEmail" Placeholder="Nome de usuário" IsEnabled="True" WidthRequest="300" HorizontalOptions="CenterAndExpand" Text="" TextColor="Black"&gt;&lt;/Entry&gt;
            &lt;/StackLayout&gt;
          &lt;/RelativeLayout&gt;
          &lt;RelativeLayout Scale="0.85"&gt;
            &lt;Image Source="input.png" x:Name="BgPassword"&gt;&lt;/Image&gt;
            &lt;Image Source="input_selected.png" x:Name="SelectedBgPassword" IsVisible="False"&gt;&lt;/Image&gt;
            &lt;StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Padding="10, 5, 0, 0"&gt;
              &lt;Image Source="ico_password.png" Scale="0.6"&gt;&lt;/Image&gt;
              &lt;Entry x:Name="Password" Placeholder="Senha" IsPassword="True" HorizontalOptions="CenterAndExpand" WidthRequest="300" Text="" TextColor="Black"&gt;&lt;/Entry&gt;
            &lt;/StackLayout&gt;
          &lt;/RelativeLayout&gt;--&gt;
          &lt;Image x:Name="LoginButtonFm" Style="{StaticResource FmLoginButton}" Scale="0.85"&gt;&lt;/Image&gt;
          &lt;Label Text="OU" TextColor="Black" HorizontalOptions="CenterAndExpand"&gt;&lt;/Label&gt;
          &lt;Image x:Name="LoginButtonFacebook" Style="{StaticResource FacebookLoginButton}" Scale="0.85"&gt;&lt;/Image&gt;
          &lt;Image x:Name="LoginButtonGoogle" Style="{StaticResource GoogleLoginButton}" Scale="0.85"&gt;&lt;/Image&gt;
          &lt;Image x:Name="LoginButtonTwitter" Style="{StaticResource TwitterLoginButton}" Scale="0.85"&gt;&lt;/Image&gt;
        &lt;/StackLayout&gt;
      &lt;/RelativeLayout&gt;
    &lt;/ScrollView&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>Thanks!</p>