How to set a Bitmap Image as Source of an image in Windows Phone 7?

By | March 29, 2012

This is a sample code snippet that adds a Bitmap as Source of an image in windows phone 7.

            Uri uri = new Uri("Background.png", UriKind.Relative);
            StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
            BitmapImage bmp = new BitmapImage();
            image1.Source = bmp;

Assuming you have placed an image in the UI and named it image1.

Leave a Reply

Your email address will not be published. Required fields are marked *