---
title: "Bitmap images Binding"  
description: "Bitmap images Binding"  
author: "Anonymous User"  
published: 2013-12-18  
updated: 2013-12-18  
canonical: https://www.mindstick.com/forum/1802/bitmap-images-binding  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Bitmap images Binding

What is the [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) ? Why the firstimage did not show on XAML [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) when I am [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) the [source](https://www.mindstick.com/interview/840/what-happens-if-the-both-source-and-destination-are-named-same) of [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in XAML to firstimage here in the code? The [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) contains the code is not a [partial](https://www.mindstick.com/blog/78/partial-class-in-dot-net) class.

```
if (ImagesAsSource[realty.ObjectId].Count == 0)//private static Uri _baseUri = new
Uri("ms-appx:///");{    Uri img = new
Uri(_baseUri, "Assets/back.jpg");    BitmapImage result
= new BitmapImage();    result.UriSource =
img;    // firstimage  is type of ImageSoure    firstimage  =result;}//I tried this://private static Uri _baseUri = new
Uri("ms-appx:///");{    Uri img = new Uri(_baseUri,
"Assets/back.jpg");    BitmapImage result
= new BitmapImage(img );    // firstimage  is type of ImageSoure    firstimage  =result;}
```

## Replies

### Reply by Anonymous User

Hi Tanuj,

You should try something like this:

```
Uri img = new Uri(_baseUri, "Assets/back.jpg");var webClient = new WebClient();byte[] imageBytes = webClient.DownloadData(img);BitmapImage result = new BitmapImage(imageBytes);
```

In fact I don't know constructor for your BitmapImage, so may be you should convert byte[] into Stream


---

Original Source: https://www.mindstick.com/forum/1802/bitmap-images-binding

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
