Reputation: 4490
On a WPF window I have an image object. I clicked the button to assign a source, the window for it popped up, I added the image in there (clicking add). When the image loaded in, instead of showing the image, it just showed a white box. I try to assign this white box as the image source, and it just says "property value is not valid." The solution explorer clearly shows that the images are there, and I can double click and open to edit them. So why isn't VS liking how I'm trying to assign images to my wpf image object? I've added images to WPF projects several times using this method.
Upvotes: 5
Views: 22072
Reputation: 17145
In case other people read this, restarting the Visual Studio might help.
Upvotes: 14
Reputation: 3130
I had a similar problem just now with VS 2012. It was traced to the fact that I'd given one of my UserControl
s a NameProperty
of "This", in order to internally reference some dependency properties I'd defined for the controls.
Don't give your UserControl
s a Name="This"
property in XAML. It gets confooosed.
Upvotes: 2
Reputation: 4490
So, it turns out the reason for this particular error was there was a space in my solution name. I guess this caused there to be a space in the path for the image, which VS just couldn't handle. Odd, but that was it.
Upvotes: 2
Reputation: 11
I just had the same issue. Because the pictures are being referenced by the project as resources they need to be compiled into the project. So in my case I added them to the solution, then built the project. At that point they were available to assign to the image control.
Upvotes: 1