title: WP7 - Set background image on all pages
body: <p>My goal is to set a background picture for each page. 
  Consider this structure...</p>
  
  <pre><code>/Images/AppBackground.jpg
  /App.xaml
  /MainPage.xaml
  /Page2.xaml
  </code></pre>
  
  <p>My first try was setting it on the rootframe as suggested elsewhere on this site... ;)</p>
  
  <p><strong>App.xaml.cs</strong></p>
  
  <pre><code>ImageBrush brush = new ImageBrush
  {
      ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Images/AppBackground.jpg", UriKind.Relative)),
      Opacity = 0.5d
  };
  this.RootFrame.Background = brush;
  </code></pre>
  
  <p>This will give me an error: 
  <code>A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll</code></p>
  
  <p>I tried with and without the starting <code>/</code>, tried <code>UriKind.Absolute</code>, And without a <code>UriType</code> parameter, all will give me the same error. The Image <code>AppBackground.jpg</code> has Build Action <code>Content</code>.</p>
  
  <p>Below code will work just fine. </p>
  
  <p><strong>MainPage.xaml</strong></p>
  
  <pre><code>&lt;Grid x:Name="LayoutRoot"&gt;
      &lt;Grid.Background&gt;
          &lt;ImageBrush ImageSource="/Images/AppBackground.jpg"&gt;&lt;/ImageBrush&gt;
      &lt;/Grid.Background&gt;
      ...
  </code></pre>
  
  <p>But that's not what I want, I don't want to set it for each page... </p>
  
  <p>Anyone any idea what I'm screwing up? ;)</p>