Displaying image in WPF image control

Unlike in .Net 2.0, the image control have a new type of source class, called Windows.Media.ImageSource. While writing simple WPF application I want to display an image in a Image control. But Windows.Media.ImageSource is abstract class, where I can’t create the object.

After googling I found a solution.

Image1.Source = New BitmapImage(New Uri(FlOpenDlg.Filename)) 'New Uri(Filename or address as string), so I passing the Open File Dialog's Filename property as the argument.

This entry was posted in .Net, WPF. Bookmark the permalink.

4 Responses to Displaying image in WPF image control

  1. provogirl says:

    how if displaying image in image control but on the other window???

  2. anuraj says:

    Hai Provogirl

    Sorry I can’t understand you. Can you tell exactly what the stuff you want? So that I can help you.

  3. csjasnoch says:

    Thanx dude!

    Simple is always better, and I found some ‘supposed’ solutions but could nto get any of them to work. First try and wammo!
    Thanx again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s