Sergio Tapia
Sergio Tapia

Reputation: 41208

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

I'm doing this:

<Image Grid.Column="0" Grid.Row="0" x:Name="Andromeda" Source="/Resources/64px-Andromedahero.gif" />

But it's just not working. :S

Here's a screenshot of the file/folder hierarchy. Any help?

alt text

Upvotes: 0

Views: 177

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564801

A couple of potential options:

  1. Make sure that your resources are set to be compiled as embedded resources.
  2. If this is a control library, and you're using this from a separate application, you may need to use a Pack URI.

Edit:

If it's a control library, you'll want to use:

Source="pack://application:,,,/MyControlLibraryAssembly;component/Resources/64px-Andromedahero.gif"

Upvotes: 1

Related Questions