Why can't I set the Image Source in WPF app?
image, resources, wpf, xaml
Solution
Have a read through this article - though be warned it's not particularly light reading :-)
I suspect what you want for your image path is `pack://application:,,,/pinHorizontal.gif`. if your image is set to a `BuildAction` of `Resource`, this will work fine.
Problem
I'm just learning WPF. I'm using VS 2008. I've added an Image control to my XAML, and I added a GIF file to the project. If I use the XAML Designer's property panel to set the image's Source property, the drop-down list for the Source property contains the following: C:\Sample Project;component/pinHorizontal.gif There are several problems with this: My project, named "Sample Project," is not in the root of my drive. Why is ";component" in there? If I select this value as given, I get the error "Property value is not valid" (yeah, no kidding). If I go into the XAML source and set the Source property manually, like so: ``` <Image Name="PinImage" Source="pinHorizontal.gif"/> ``` The XAML Designer gives me this error: "The file pinHorizontal.gif is not part of the project or its 'Build Action' property is not set to 'Resource'." Why is this task so difficult? How do I assign an image source?