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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:46:34+00:00 2026-06-06T19:46:34+00:00

I am having a problem with my Windows Phone application. When I get the

  • 0

I am having a problem with my Windows Phone application. When I get the photo from a web service, I want to display it as an image on the page. The web service returns a byte[] as the image data.

Dispatcher.BeginInvoke(() =>
{
    tempImage = new BitmapImage();
    globalWrapper = (PhotoWrapper)JsonConvert.DeserializeObject(
                                      response.Content, typeof(PhotoWrapper));
    tempImage.SetSource(new MemoryStream(globalWrapper.PictureBinary, 0,
                                         globalWrapper.PictureBinary.Length));
    globalWrapper.ImageSource = tempImage;
    PictureList.Items.Add(globalWrapper);
});

PictureList is a ListBox defined as:

<ListBox Name="PictureList" ItemsSource="{Binding}" Margin="0,0,0,0">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <Button Click="details_Click">
                    <Button.Content>
                        <Image Source="{Binding ImageSource}"></Image>
                    </Button.Content>
                 </Button>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Now, my question is, how do you receive a byte[] from a webservice as JSON and display it on the page? I feel like I am pretty close here but am missing something rather elementary.

  • 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-06T19:46:36+00:00Added an answer on June 6, 2026 at 7:46 pm

    If you’re certain that the byte[] data is valid, it could be something to do with the CacheOption property of the BitmapUmage. This property controls when data is actually loaded from the stream into the bitmap. The default is OnDemand, which only loads data from the stream when the image is displayed. You might want to try the OnLoad option instead, which loads it immediately, allowing you to close the stream.

    Dispatcher.BeginInvoke(() =>
    {
        globalWrapper = (PhotoWrapper)JsonConvert.DeserializeObject(
                                          response.Content, typeof(PhotoWrapper));
        tempImage = new BitmapImage();
        tempImage.BeginInit();
        tempImage.CacheOption = BitmapCacheOption.OnLoad;
        tempImage.SetSource(new MemoryStream(globalWrapper.PictureBinary, 0,
                                             globalWrapper.PictureBinary.Length));
        tempImage.EndInit();
        globalWrapper.ImageSource = tempImage;
        PictureList.Items.Add(globalWrapper);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having trouble querying a web server for information from my Windows Phone
I am having problem with download my android application from my own web server.
I having problem when I deploy an application on Windows Mobile Device .The device
I am having a problem in MySql.Data.MySqlClient.MySqlTransaction in a Windows Communication Foundation Server Application.
I am working on a simple windows forms paint application. I am having problem
I am having problems debugging a Windows Phone XNA game application. I can build
I'm working on a Windows Phone app and am having the following problem. I
I'm trying to get MVVMLight working on Windows Phone 7 and having a small
Currently porting an application to Windows Phone 7 I've encountered a problem that should
I'm having problem when running my Windows Forms program. In the program, I have

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.