title: Set Background image to a page/screen in Xamarin Forms
body: <p>I am trying to make an app, using Xamarin Forms, in Visual Studio 2015. I want to add background image to the screen/page. So far, I have reached here, as seen in the below code but it doesn't work.</p>
  
  <p>This is my MainPage.XAML code.</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"
               xmlns:local="clr-namespace:TrackMyMeds"
               x:Class="TrackMyMeds.MainPage"
               BackgroundImage="/Images/blue_gradient"&gt;
  
      &lt;StackLayout BackgroundColor="Gray" Padding="8,15,8,0"&gt;
  
          &lt;Label HorizontalTextAlignment="Center" Text="Welcome to TrackMyMeds" TextColor="White" FontSize="40" FontAttributes="Bold"&gt;
  
          &lt;/Label&gt;
  
          &lt;Label HorizontalTextAlignment="Center" Text="Let us take charge of your health" TextColor="Black" FontSize="18"&gt;
  
          &lt;/Label&gt;
          &lt;StackLayout Padding="0,40,0,15"&gt;
              &lt;Label Text="If you already have an account:" TextColor="Black"&gt;
  
              &lt;/Label&gt;
  
              &lt;Button Clicked="LoginPage_Clicked" Text="Log In Here!" BackgroundColor="#387ef5" TextColor="White" FontSize="18"&gt;
  
              &lt;/Button&gt;
          &lt;/StackLayout&gt;
          &lt;StackLayout Padding="0,15,0,0"&gt;
              &lt;Label Text="If you're new here then:" TextColor="Black"&gt;
  
              &lt;/Label&gt;
  
              &lt;Button Clicked="SignupPage_Clicked" Text="Sign Up Here!" BackgroundColor="#387ef5" TextColor="White" FontSize="18"&gt;
  
              &lt;/Button&gt;
          &lt;/StackLayout&gt;
  
      &lt;/StackLayout&gt;
  
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>This is my MainPage.xaml.cs code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using Xamarin.Forms;
  
  namespace TrackMyMeds
  {
      public partial class MainPage : ContentPage
      {
          public MainPage()
          {
              InitializeComponent();
          }
  
          private void LoginPage_Clicked(object sender, EventArgs e)
          {
              App.Current.MainPage = new LoginPage();
          }
  
          private void SignupPage_Clicked(object sender, EventArgs e)
          {
              App.Current.MainPage = new SignupPage();
          }
      }
  }
  </code></pre>