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 8607599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:23:59+00:00 2026-06-12T03:23:59+00:00

In the ApplicationData.Current.RomanigFolder, I save an jpg file. It is possible to read the

  • 0

In the ApplicationData.Current.RomanigFolder, I save an jpg file. It is possible to read the content of this file in a stream or MemoryStream and set it to the ImageSource?

I use it in a WPF-Application with .NET 4.0 with follwing code: (img is a XAML-Image-Control

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.OnLoad;
StreamReader sr = new StreamReader(data.message.imageUrl);
bi.StreamSource = sr.BaseStream;
bi.EndInit();
img.Source = bi;
sr.Close();

For a Metro app I see no way to set a StreamSource to an BitmapImage. How can I set a Image-File to an Image-Control?

  • 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-12T03:24:00+00:00Added an answer on June 12, 2026 at 3:24 am

    For writing “Metro Style Apps”, or apps built for Windows 8, to set the source of an image in WPF project.

    Here’s the code:

    // Usage
    myImage.Source = ImageFromRelativePath(this, "relative_path_to_file_make_sure_build_set_to_content");
    
    public static BitmapImage ImageFromRelativePath(FrameworkElement parent, string path)
    {
        var uri = new Uri(parent.BaseUri, path);
        BitmapImage result = new BitmapImage();
        result.UriSource = uri;
        return result;
    }
    

    Reference: http://www.codingbeta.com/programatically-setting-image-source-in-metro-style-apps-with-wpf/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access a file, that might not exist: var localFolder = Windows.Storage.ApplicationData.current.localFolder;
I have saved an image file to Windows.Storage.ApplicationData.Current.LocalFolder. How do I get the path
What is the best way to read amnd write and IO.Stream (Zip file downloded
My application is currently storing settings in an INI file under the current user's
I currently have an issue with a file read in a Windows 8/WinRT application.
I need to install a file into the Environment.SpecialFolder.ApplicationData folder, which differs between XP
Possible Duplicate: How can i get the path of the current user's “Application Data”
What I need to do is to get ApplicationData path , I've found in
We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
I'm designing my application data model and I have a doubt, whether to use

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.