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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:53:46+00:00 2026-05-30T08:53:46+00:00

I am new in windows phone , Now am doing a sample just trying

  • 0

I am new in windows phone ,

Now am doing a sample just trying to show an image in a stack panel.

I want to show the image in its actual height and width. But the actual height and width returns 0.

Actually the image with height of 360px and width of 480 px.

I posted my code below. Pls help.

Thanks.

MaingPage.xaml

<Grid x:Name="LayoutRoot" Background="Transparent">
    <StackPanel Name="imagePanel" ></StackPanel>
</Grid>

MainPage.xaml.cs

namespace ImageResizing
{
public partial class MainPage : PhoneApplicationPage
{
    Image myImage;
    BitmapImage bit;

    // Constructor
    public MainPage()
    {
        InitializeComponent();

        myImage = new Image();
        Uri uri = new Uri("Penguins.jpg", UriKind.Relative);
        bit = new BitmapImage(uri);
        myImage.Source = bit;

        myImage.Width = myImage.ActualWidth; // Returns 0
        myImage.Height = myImage.ActualHeight; // Returns 0

        myImage.Width = bit.PixelWidth;  // Also tried this. It returns 0 too
        myImage.Height = bit.PixelHeight; // Also tried this. It returns 0 too


        myImage.Stretch = Stretch.Fill;
        imagePanel.Children.Add(myImage);
    }
  }
}
  • 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-05-30T08:53:48+00:00Added an answer on May 30, 2026 at 8:53 am

    They are zero until AFTER that call to myImage.Source = bit; Prior to that myImage is just an empty image that doesn’t have any content.

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

Sidebar

Related Questions

I am new in windows phone development. Now I am trying to study about
I just got myself a new toy, a phone with Windows Mobile 6. I'm
I've just installed the Beta version of the windows phone developer tools, however now
I am new in windows phone development. Now I am developing a windows phone
I am trying to create a reddit app (just for practice) for Windows Phone
I'm new to windows phone 7 I want to ask for your help in
I am new to Windows Phone 7 application development. I am trying to call
Where can I find the SDK for new Windows Phone 7?
I am very new at all this c# Windows Phone programming, so this is
I have made a new windows service which works fine using barebone code (just

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.