Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '49' and line position '38'

Tags:

c#

wpf

I am making my first wpf application which now just implements a "floor" with a texture, viewed from above. when running I get this exception:

Provide value on System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '49' and line position '38'

The line they talk about is

<ImageBrush ImageSource="/wood1_1000X1000.jpg" />.

I also tried with a png extension. The image has a resolution of 1000 x 1000.

like image 411
Asercu Avatar asked Mar 29 '14 20:03

Asercu


1 Answers

Assuming the image is:

  • Included in your project
  • It's in a folder named "Images"
  • The build action for the image is set to "Resource" (should be the default)

You can reference it like this:

<ImageBrush ImageSource=
   "pack://application:,,,/YourProjectName;component/Images/wood1_1000X1000.jpg";
like image 127
Grant Winney Avatar answered Nov 08 '22 00:11

Grant Winney