none
How do I "force load" a BitmapImage so I can access the PixelWidth/Height without involving an Image class instance?

    Question

  • Hi there,

    I am loading a packaged bitmap:

                    BitmapImage bitmapImage = new BitmapImage(new Uri(@"ms-appx:///Image.png"));

    I want to get the PixelWidth and PixelHeight of the BitmapImage, but I noticed that they are alwasy 0, unless I assign it to an instance of the Image class:

                Image = new Image();
                Image.Source = bitmapImage;

    After the above line, I am able to get the appropriate PixelWidth and PixelHeight values.

    Is there a way for me to achieve the same thing without creating Image instances?

    Thanks,

    Henry = ]

    Saturday, April 07, 2012 2:01 AM

All replies