title: How to Change XAML Grid Background
body: <p>I have the following <code>XAML</code> code to create a Windows Universal App:<br></p>
  
  <pre><code>&lt;Page
  x:Class="CalculationQuizzer.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="using:CalculationQuizzer"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"&gt;
  &lt;Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"&gt;
      &lt;Image Source="ms-appx:///Images/kingscross.jpg" Opacity=".3" Stretch="Fill"&gt;&lt;/Image&gt;
      &lt;StackPanel VerticalAlignment="Center"&gt;
          &lt;TextBlock Text="Calculation Quizzer" TextAlignment="Center" Margin="4" FontSize="16"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock Name="questionTextBlock" Text="" TextAlignment="Center" Margin="4"&gt;&lt;/TextBlock&gt;
          &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="4"&gt;
              &lt;TextBox Name="answerTextBox" Width="100" Margin="4" TextAlignment="Center"&gt;&lt;/TextBox&gt;
              &lt;Button Content="Check Answer" Name="checkAnswerButton" HorizontalAlignment="Center"  Margin="4" Click="checkAnswerButton_Click" &gt;&lt;/Button&gt;
          &lt;/StackPanel&gt;
          &lt;Button Content="Next Question" Name="getNextQuestionButton" HorizontalAlignment="Center"  Margin="4" Click="getNextQuestionButton_Click" &gt;&lt;/Button&gt;
          &lt;TextBlock Name="resultTextBlock" Text="" TextAlignment="Center" Margin="4"&gt;&lt;/TextBlock&gt;
      &lt;/StackPanel&gt;
      &lt;MediaElement Name="soundMediaElement"&gt;&lt;/MediaElement&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see the Grid uses an Image called <code>kingscross.jpg</code> for it's background. I'm trying to make it so that the click on button <code>Next Answer</code> will cause Grid background to change to an Image called <code>SKV_8915_s.jpg</code>.<br></p>
  
  <p>Here is a code behind the <code>XAML</code>:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Runtime.InteropServices.WindowsRuntime;
  using Windows.Foundation;
  using Windows.Foundation.Collections;
  using Windows.UI.Xaml;
  using Windows.UI.Xaml.Controls;
  using Windows.UI.Xaml.Controls.Primitives;
  using Windows.UI.Xaml.Data;
  using Windows.UI.Xaml.Input;
  using Windows.UI.Xaml.Media;
  using Windows.UI.Xaml.Navigation;
  using Windows.UI.Xaml.Media.Imaging;
  
  // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&amp;clcid=0x409
  
  namespace CalculationQuizzer
  {
      /// &lt;summary&gt;
      /// An empty page that can be used on its own or navigated to within a Frame.
      /// &lt;/summary&gt;
      public sealed partial class MainPage : Page
      {
          IQuizObject activeQuiz;
  
          public MainPage()
          {
              this.InitializeComponent();
  
              activeQuiz = new AdditionQuizObject();
              questionTextBlock.Text = activeQuiz.GetQuestion();
          }
  
          private void getNextQuestionButton_Click(object sender, RoutedEventArgs e)
          {
              activeQuiz.NextQuestion();
              questionTextBlock.Text = activeQuiz.GetQuestion();
              answerTextBox.Text = "";
              resultTextBlock.Text = "";
          }
  
          private void checkAnswerButton_Click(object sender, RoutedEventArgs e)
          {
              if (activeQuiz.CheckAnswer(answerTextBox.Text))
              {
                  resultTextBlock.Text = "Correct! Well done.";
                  Uri soundsource = new Uri("ms-appx:///Sounds/right.wav");
                  soundMediaElement.Source = soundsource;
                  soundMediaElement.Play();
              }
              else
              {
                  resultTextBlock.Text = "Sorry, that is not correct.";
                  Uri soundsource = new Uri("ms-appx:///Sounds/wrong.wav");
                  soundMediaElement.Source = soundsource;
                  soundMediaElement.Play();
              }
          }
      }
  </code></pre>
  
  <p>If some of you guys could tell me which code do I need to plug into event handler for <code>CheckAnswerButton_Click</code> so that it changes the background of the Grid, to <code>SKV_8915_s.jpg</code>, that would be super amazing!</p>