Sergio Tapia
Sergio Tapia

Reputation: 41208

How can I set an Image to an Image control in WPF?

I'm trying to do this:

imgUser.Source = new Uri(user.Photo);

But I'm getting an error that I cannot convert a URI to an ImageSource.

Upvotes: 1

Views: 85

Answers (1)

Quartermeister
Quartermeister

Reputation: 59169

BitmapImage is an ImageSource and can be created from a Uri:

imgUser.Source = new BitmapImage(new Uri(user.Photo));

Upvotes: 4

Related Questions