How to Add a Background Image to the Windows Phone Panorama App


username

I'm trying to add a background image to a Windows Phone Panorama app. When I add the image using XAML code, I can see the image in the preview. However, when I run the app, I can't see the image. The image size I use is 1536x1280

Here is the XAML code I use;

<phone:Panorama.Background>
     <ImageBrush ImageSource="/Assets/back.png"/>
</phone:Panorama.Background>

I also tried the C# code below;

        BitmapImage bitmapImage = new BitmapImage(new Uri("/Assets/back.png", UriKind.Relative));
        ImageBrush imageBrush = new ImageBrush();
        imageBrush.ImageSource = bitmapImage;
        this.Background = imageBrush;

How do I see in Visual Studio previewHow do I see in Visual Studio preview

how can i see in simulator and devicehow can i see in simulator and device

Chris Shao

Check the "Generate Action" for the image file. (In your solution, right click on the image file and view its properties).

If the "build action" is 'Content', then your code is correct.

However, if the "build action" is 'Resources', the image path should be modified to: "ms-appx:///Assets/back.png"

Related


How to Add a Background Image to the Windows Phone Panorama App

username I'm trying to add a background image to a Windows Phone Panorama app. When I add the image using XAML code, I can see the image in the preview. However, when I run the app, I can't see the image. The image size I use is 1536x1280 Here is the XAML code

How to Add a Background Image to the Windows Phone Panorama App

username I'm trying to add a background image to a Windows Phone Panorama app. When I add the image using XAML code, I can see the image in the preview. However, when I run the app, I can't see the image. The image size I use is 1536x1280 Here is the XAML code

How to Add a Background Image to the Windows Phone Panorama App

username I'm trying to add a background image to a Windows Phone Panorama app. When I add the image using XAML code, I can see the image in the preview. However, when I run the app, I can't see the image. The image size I use is 1536x1280 Here is the XAML code

How to Add a Background Image to the Windows Phone Panorama App

username I'm trying to add a background image to a Windows Phone Panorama app. When I add the image using XAML code, I can see the image in the preview. However, when I run the app, I can't see the image. The image size I use is 1536x1280 Here is the XAML code

How to Change the Background Image of a Windows Phone App

Gunyangolo I'm developing an WP8app and want to change the background imagewith several images ; set the time as a variable and display the images in C#, Bilal Amjad You can use the DispatcherTimer class to change the image based on time. Let me suggest you th

How to Change the Background Image of a Windows Phone App

Gunyangolo I'm developing an WP8app and want to change the background imagewith several images ; set the time as a variable and display the images in C#, Bilal Amjad You can use the DispatcherTimer class to change the image based on time. Let me suggest you th

Add blur background in Windows Phone app

Balraj Singh How to add blur background with some transparency in windows phone application. I can create a transparent background AF FFFFFF using the opacity property or the first two letter numbers using the six color code # . But I can't find any way to add

Add blur background in Windows Phone app

Balraj Singh How to add blur background with some transparency in windows phone application. I can create a transparent background AF FFFFFF using the opacity property or the first two letter numbers using the six color code # . But I can't find any way to add

Add blur background in Windows Phone app

Balraj Singh How to add blur background with some transparency in windows phone application. I can create a transparent background AF FFFFFF using the opacity property or the first two letter numbers using the six color code # . But I can't find any way to add

How to set a background image in Windows Phone 8?

Baqer Naqvi I'm very new to WPapps and don't know how to set an image in a file for the whole app in the app . Until now I put some on it but failed to set the background image. I have looked at some sources, but to no avail. Any help would be greatly apprecia

How to add background image in Flutter app?

fccoelho: I'm trying to add a background image to my Flutter app, so I'm going through all similar issues. Application m works fine but no image appears. Here is my widget code: @override Widget build(BuildContext context) { return MaterialApp(

How to add background image in Flutter app?

fccoelho: I'm trying to add a background image to my Flutter app, so I'm going through all similar issues. Application m works fine but no image appears. Here is my widget code: @override Widget build(BuildContext context) { return MaterialApp(

How to add background image in Flutter app?

fccoelho: I'm trying to add a background image to my Flutter app, so I'm going through all similar issues. Application m works fine but no image appears. Here is my widget code: @override Widget build(BuildContext context) { return MaterialApp(

How to add background image in Flutter app?

fccoelho: I'm trying to add a background image to my Flutter app, so I'm going through all similar issues. Application m works fine but no image appears. Here is my widget code: @override Widget build(BuildContext context) { return MaterialApp(

How can I set a background image via code on Windows Phone?

Pascal My problem is simple, but I can't find a working solution. I code a Windows Phone app and have to change the background. Changes depend on the user profile on the application. If the user is male, the application displays a blue background; if the user

How can I set a background image via code on Windows Phone?

Pascal My problem is simple, but I can't find a working solution. I code a Windows Phone app and have to change the background. Changes depend on the user profile on the application. If the user is male, the application displays a blue background; if the user

How can I set a background image via code on Windows Phone?

Pascal My problem is simple, but I can't find a working solution. I code a Windows Phone app and have to change the background. Changes depend on the user profile on the application. If the user is male, the application displays a blue background; if the user

Windows 8 Phone App - How to add a "Share App" button?

David I have an app in which I want to add a share button. When the button is clicked, I want it to open the following window: The user will then select a share location and the following default message will be displayed: "Just found this awesome app! Find it

Windows 8 Phone App - How to add a "Share App" button?

David I have an app in which I want to add a share button. When the button is clicked, I want it to open the following window: The user will then select a share location and the following default message will be displayed: "Just found this awesome app! Find it

Windows 8 Phone App - How to add a "Share App" button?

David I have an app in which I want to add a share button. When the button is clicked, I want it to open the following window: The user will then select a share location and the following default message will be displayed: "Just found this awesome app! Find it

Windows 8 Phone App - How to add a "Share App" button?

David I have an app in which I want to add a share button. When the button is clicked, I want it to open the following window: The user will then select a share location and the following default message will be displayed: "Just found this awesome app! Find it

Panorama control in Universal Windows App

Michael Kalinski I was wondering if there was a way to implement Panorama Control from Windows Phone 8 into Microsoft's new Universal Windows Platform. The Panorama Control looks and feels great, I really can't figure out why Microsoft didn't implement this co

Panorama control in Universal Windows App

Michael Kalinski I was wondering if there was a way to implement Panorama Control from Windows Phone 8 into Microsoft's new Universal Windows Platform. The Panorama Control looks and feels great, I really can't figure out why Microsoft didn't implement this co

App background image shows on tablet but not on phone

YYYY I am working with Android Studio. I have one layout for all devices. Everything went well tabletand went smoothly phone. Then, I changed my background image, and added the layout landscape, large-landscapeand large-port. Now when I run the app on my table

App background image shows on tablet but not on phone

YYYY I am working with Android Studio. I have one layout for all devices. Everything went well tabletand went smoothly phone. Then, I changed my background image, and added the layout landscape, large-landscapeand large-port. Now when I run the app on my table