Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8267517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:33:36+00:00 2026-06-08T05:33:36+00:00

My goal is to set a background picture for each page. Consider this structure…

  • 0

My goal is to set a background picture for each page.
Consider this structure…

/Images/AppBackground.jpg
/App.xaml
/MainPage.xaml
/Page2.xaml

My first try was setting it on the rootframe as suggested elsewhere on this site… 😉

App.xaml.cs

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;

This will give me an error:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

I tried with and without the starting /, tried UriKind.Absolute, And without a UriType parameter, all will give me the same error. The Image AppBackground.jpg has Build Action Content.

Below code will work just fine.

MainPage.xaml

<Grid x:Name="LayoutRoot">
    <Grid.Background>
        <ImageBrush ImageSource="/Images/AppBackground.jpg"></ImageBrush>
    </Grid.Background>
    ...

But that’s not what I want, I don’t want to set it for each page…

Anyone any idea what I’m screwing up? 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:33:38+00:00Added an answer on June 8, 2026 at 5:33 am

    Crap. Wrong place; I was to early. In the constructor, it will simple overwrite the Background setting…

    If I execute it at a later point, it’ll work just fine… 🙂

    // Code to execute when the application is launching (eg, from Start)
    // This code will not execute when the application is reactivated
    private void Application_Launching(object sender, LaunchingEventArgs e)
    {
        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;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android app with an background image. My goal is to create
In Google Analytics I set a Goal that is a simple URL Destination using
The goal would be to set the profile the same way as in a
I have the pages that I want to set as a goal in Google
I'm trying to set up integration tests using the AbstractTransactionalJUnit4SpringContextTests base class. My goal
GOAL : To customize the background view of cell. Here is what I am
My website structure is a header, content, footer. My goal is that every time
Goal: I want to write an X86_64 assembler. Note: marked as community wiki Background:
I'm trying to animate a background image to move down a set amount of
My main goal is to get this up and running. My hook gets called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.